Merged revisions 79274 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79274 | michael.foord | 2010-03-21 21:49:08 -0500 (Sun, 21 Mar 2010) | 1 line

  Correct usage message displayed for python -m unittest -h
........
This commit is contained in:
Benjamin Peterson 2010-03-22 02:53:52 +00:00
parent f8197c3489
commit eab4b4c784
3 changed files with 4 additions and 10 deletions

View File

@ -52,6 +52,7 @@ __all__ = ['TestResult', 'TestCase', 'TestSuite',
# Expose obsolete functions for backwards compatibility # Expose obsolete functions for backwards compatibility
__all__.extend(['getTestCaseNames', 'makeSuite', 'findTestCases']) __all__.extend(['getTestCaseNames', 'makeSuite', 'findTestCases'])
__unittest = True
from .result import TestResult from .result import TestResult
from .case import (TestCase, FunctionTestCase, SkipTest, skip, skipIf, from .case import (TestCase, FunctionTestCase, SkipTest, skip, skipIf,
@ -64,5 +65,3 @@ from .runner import TextTestRunner, TextTestResult
# deprecated # deprecated
_TextTestResult = TextTestResult _TextTestResult = TextTestResult
__unittest = True

View File

@ -6,6 +6,7 @@ if sys.argv[0].endswith("__main__.py"):
__unittest = True __unittest = True
from .main import main, TestProgram, USAGE_AS_MAIN
TestProgram.USAGE = USAGE_AS_MAIN
from .main import main
main(module=None) main(module=None)

View File

@ -58,17 +58,11 @@ Examples:
in MyTestCase in MyTestCase
""" """
if __name__ == '__main__':
USAGE = USAGE_AS_MAIN
else:
USAGE = USAGE_FROM_MODULE
class TestProgram(object): class TestProgram(object):
"""A command-line program that runs a set of tests; this is primarily """A command-line program that runs a set of tests; this is primarily
for making test modules conveniently executable. for making test modules conveniently executable.
""" """
USAGE = USAGE USAGE = USAGE_FROM_MODULE
def __init__(self, module='__main__', defaultTest=None, def __init__(self, module='__main__', defaultTest=None,
argv=None, testRunner=None, argv=None, testRunner=None,
testLoader=loader.defaultTestLoader, exit=True, testLoader=loader.defaultTestLoader, exit=True,