[Zope3-checkins]
SVN: zope.testing/trunk/src/zope/testing/testrunner
add options to disable colorized output: --no-color and -C
Benji York
benji at zope.com
Mon Jul 16 02:51:10 EDT 2007
Log message for revision 78018:
add options to disable colorized output: --no-color and -C
Changed:
U zope.testing/trunk/src/zope/testing/testrunner-colors.txt
U zope.testing/trunk/src/zope/testing/testrunner.py
-=-
Modified: zope.testing/trunk/src/zope/testing/testrunner-colors.txt
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-colors.txt 2007-07-16 06:46:42 UTC (rev 78017)
+++ zope.testing/trunk/src/zope/testing/testrunner-colors.txt 2007-07-16 06:51:10 UTC (rev 78018)
@@ -221,6 +221,37 @@
<BLANKLINE>
{normal} Ran {green}1{normal} tests with {boldred}1{normal} failures and {green}0{normal} errors in {green}0.003{normal} seconds.{normal}
+If -c or --color have been previously provided on the command line (perhaps by
+a test runner wrapper script), but no colorized output is desired, the -C or
+--no-color options will disable colorized output:
+
+ >>> sys.argv = 'test --layer 122 -c -C'.split()
+ >>> testrunner.run(defaults)
+ Running samplelayers.Layer122 tests:
+ Set up samplelayers.Layer1 in 0.000 seconds.
+ Set up samplelayers.Layer12 in 0.000 seconds.
+ Set up samplelayers.Layer122 in 0.000 seconds.
+ Ran 34 tests with 0 failures and 0 errors in 0.007 seconds.
+ Tearing down left over layers:
+ Tear down samplelayers.Layer122 in 0.000 seconds.
+ Tear down samplelayers.Layer12 in 0.000 seconds.
+ Tear down samplelayers.Layer1 in 0.000 seconds.
+ False
+
+
+ >>> sys.argv = 'test --layer 122 -c --no-color'.split()
+ >>> testrunner.run(defaults)
+ Running samplelayers.Layer122 tests:
+ Set up samplelayers.Layer1 in 0.000 seconds.
+ Set up samplelayers.Layer12 in 0.000 seconds.
+ Set up samplelayers.Layer122 in 0.000 seconds.
+ Ran 34 tests with 0 failures and 0 errors in 0.007 seconds.
+ Tearing down left over layers:
+ Tear down samplelayers.Layer122 in 0.000 seconds.
+ Tear down samplelayers.Layer12 in 0.000 seconds.
+ Tear down samplelayers.Layer1 in 0.000 seconds.
+ False
+
Clean up:
>>> sys.stdout = real_stdout
Modified: zope.testing/trunk/src/zope/testing/testrunner.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner.py 2007-07-16 06:46:42 UTC (rev 78017)
+++ zope.testing/trunk/src/zope/testing/testrunner.py 2007-07-16 06:51:10 UTC (rev 78018)
@@ -2007,6 +2007,13 @@
""")
reporting.add_option(
+ '--no-color', '-C', action="store_false", dest='color',
+ help="""\
+Do not colorize the output. This is the default, but can be used to
+counter a previous use of --color or -c.
+""")
+
+reporting.add_option(
'-1', '--hide-secondary-failures',
action="store_true", dest='report_only_first_failure',
help="""\
More information about the Zope3-Checkins
mailing list