[Python-checkins] r81056 - in python/branches/py3k: Lib/unittest/__main__.py Lib/unittest/main.py

michael.foord python-checkins at python.org
Mon May 10 22:23:58 CEST 2010


Author: michael.foord
Date: Mon May 10 22:23:58 2010
New Revision: 81056

Log:
Merged revisions 81055 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81055 | michael.foord | 2010-05-10 21:21:16 +0100 (Mon, 10 May 2010) | 1 line
  
  Improving help message for python -m unittest. Issue 8303.
........


Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Lib/unittest/__main__.py
   python/branches/py3k/Lib/unittest/main.py

Modified: python/branches/py3k/Lib/unittest/__main__.py
==============================================================================
--- python/branches/py3k/Lib/unittest/__main__.py	(original)
+++ python/branches/py3k/Lib/unittest/__main__.py	Mon May 10 22:23:58 2010
@@ -2,7 +2,7 @@
 
 import sys
 if sys.argv[0].endswith("__main__.py"):
-    sys.argv[0] = "unittest"
+    sys.argv[0] = "python -m unittest"
 
 __unittest = True
 

Modified: python/branches/py3k/Lib/unittest/main.py
==============================================================================
--- python/branches/py3k/Lib/unittest/main.py	(original)
+++ python/branches/py3k/Lib/unittest/main.py	Mon May 10 22:23:58 2010
@@ -22,10 +22,9 @@
   -q, --quiet      Minimal output
 %(failfast)s%(catchbreak)s%(buffer)s
 Examples:
-  %(progName)s test_module                       - run tests from test_module
-  %(progName)s test_module.TestClass             - run tests from
-                                                   test_module.TestClass
-  %(progName)s test_module.TestClass.test_method - run specified test method
+  %(progName)s test_module               - run tests from test_module
+  %(progName)s module.TestClass          - run tests from module.TestClass
+  %(progName)s module.Class.test_method  - run specified test method
 
 [tests] can be a list of any number of test modules, classes and test
 methods.
@@ -68,7 +67,7 @@
     USAGE = USAGE_FROM_MODULE
 
     # defaults for testing
-    failfast = catchbreak = buffer = None
+    failfast = catchbreak = buffer = progName = None
 
     def __init__(self, module='__main__', defaultTest=None, argv=None,
                     testRunner=None, testLoader=loader.defaultTestLoader,
@@ -160,8 +159,10 @@
 
     def _do_discovery(self, argv, Loader=loader.TestLoader):
         # handle command line args for test discovery
+        self.progName = '%s discover' % self.progName
         import optparse
         parser = optparse.OptionParser()
+        parser.prog = self.progName
         parser.add_option('-v', '--verbose', dest='verbose', default=False,
                           help='Verbose output', action='store_true')
         if self.failfast != False:


More information about the Python-checkins mailing list