summaryrefslogtreecommitdiffstats
path: root/Lib/unittest
diff options
context:
space:
mode:
authorMichael Foord <fuzzyman@voidspace.org.uk>2010-05-10 20:21:16 (GMT)
committerMichael Foord <fuzzyman@voidspace.org.uk>2010-05-10 20:21:16 (GMT)
commit72b19772211bf2816ec9d2c24d169180a70246e7 (patch)
tree0804e8e74a876dd2e203b6c3047e340f72dff36a /Lib/unittest
parent638b869004d30dcea51fd629ff6fa180869e7641 (diff)
downloadcpython-72b19772211bf2816ec9d2c24d169180a70246e7.zip
cpython-72b19772211bf2816ec9d2c24d169180a70246e7.tar.gz
cpython-72b19772211bf2816ec9d2c24d169180a70246e7.tar.bz2
Improving help message for python -m unittest. Issue 8303.
Diffstat (limited to 'Lib/unittest')
-rw-r--r--Lib/unittest/__main__.py2
-rw-r--r--Lib/unittest/main.py11
2 files changed, 7 insertions, 6 deletions
diff --git a/Lib/unittest/__main__.py b/Lib/unittest/__main__.py
index 58e646d..7320050 100644
--- a/Lib/unittest/__main__.py
+++ b/Lib/unittest/__main__.py
@@ -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
diff --git a/Lib/unittest/main.py b/Lib/unittest/main.py
index 74d875c..3396bb0 100644
--- a/Lib/unittest/main.py
+++ b/Lib/unittest/main.py
@@ -22,10 +22,9 @@ Options:
-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 @@ class TestProgram(object):
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 @@ class TestProgram(object):
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: