Adding -b command line option to the unittest usage message.

This commit is contained in:
Michael Foord 2010-04-03 14:52:18 +00:00
parent 856a3be76a
commit d43b63fed3
1 changed files with 8 additions and 6 deletions

View File

@ -9,9 +9,9 @@ from .signals import installHandler
__unittest = True __unittest = True
FAILFAST = " -f, --failfast Stop on first failure\n"
FAILFAST = " -f, --failfast Stop on first failure\n" CATCHBREAK = " -c, --catch Catch control-C and display results\n"
CATCHBREAK = " -c, --catch Catch control-C and display results\n" BUFFEROUTPUT = " -b, --buffer Buffer stdout and stderr during test runs\n"
USAGE_AS_MAIN = """\ USAGE_AS_MAIN = """\
Usage: %(progName)s [options] [tests] Usage: %(progName)s [options] [tests]
@ -20,7 +20,7 @@ Options:
-h, --help Show this message -h, --help Show this message
-v, --verbose Verbose output -v, --verbose Verbose output
-q, --quiet Minimal output -q, --quiet Minimal output
%(failfast)s%(catchbreak)s %(failfast)s%(catchbreak)s%(buffer)s
Examples: Examples:
%(progName)s test_module - run tests from test_module %(progName)s test_module - run tests from test_module
%(progName)s test_module.TestClass - run tests from %(progName)s test_module.TestClass - run tests from
@ -34,7 +34,7 @@ Alternative Usage: %(progName)s discover [options]
Options: Options:
-v, --verbose Verbose output -v, --verbose Verbose output
%(failfast)s%(catchbreak)s -s directory Directory to start discovery ('.' default) %(failfast)s%(catchbreak)s%(buffer)s -s directory Directory to start discovery ('.' default)
-p pattern Pattern to match test files ('test*.py' default) -p pattern Pattern to match test files ('test*.py' default)
-t directory Top level directory of project (default to -t directory Top level directory of project (default to
start directory) start directory)
@ -50,7 +50,7 @@ Options:
-h, --help Show this message -h, --help Show this message
-v, --verbose Verbose output -v, --verbose Verbose output
-q, --quiet Minimal output -q, --quiet Minimal output
%(failfast)s%(catchbreak)s %(failfast)s%(catchbreak)s%(buffer)s
Examples: Examples:
%(progName)s - run default set of tests %(progName)s - run default set of tests
%(progName)s MyTestSuite - run suite 'MyTestSuite' %(progName)s MyTestSuite - run suite 'MyTestSuite'
@ -103,6 +103,8 @@ class TestProgram(object):
usage['failfast'] = FAILFAST usage['failfast'] = FAILFAST
if self.catchbreak != False: if self.catchbreak != False:
usage['catchbreak'] = CATCHBREAK usage['catchbreak'] = CATCHBREAK
if self.buffer != False:
usage['buffer'] = BUFFEROUTPUT
print self.USAGE % usage print self.USAGE % usage
sys.exit(2) sys.exit(2)