[Zope3-checkins] SVN: zope.testing/trunk/ LP #547023: Added a ``--version`` option to the testrunner.

Tres Seaver tseaver at palladion.com
Sat Apr 10 21:04:40 EDT 2010


Log message for revision 110728:
  LP #547023:  Added a ``--version`` option to the testrunner.
  

Changed:
  U   zope.testing/trunk/CHANGES.txt
  U   zope.testing/trunk/src/zope/testing/testrunner/options.py

-=-
Modified: zope.testing/trunk/CHANGES.txt
===================================================================
--- zope.testing/trunk/CHANGES.txt	2010-04-11 00:14:00 UTC (rev 110727)
+++ zope.testing/trunk/CHANGES.txt	2010-04-11 01:04:40 UTC (rev 110728)
@@ -4,6 +4,8 @@
 3.9.4 (unreleased)
 ==================
 
+- LP #547023:  Added a ``--version`` option to the testrunner.
+
 - Added tests for LP #144569 and #69988.
 
   https://bugs.launchpad.net/bugs/69988

Modified: zope.testing/trunk/src/zope/testing/testrunner/options.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner/options.py	2010-04-11 00:14:00 UTC (rev 110727)
+++ zope.testing/trunk/src/zope/testing/testrunner/options.py	2010-04-11 01:04:40 UTC (rev 110728)
@@ -21,6 +21,8 @@
 import os
 import sys
 
+import pkg_resources
+
 from zope.testing.testrunner.profiling import available_profilers
 from zope.testing.testrunner.formatter import (
     OutputFormatter,
@@ -429,6 +431,10 @@
 other = optparse.OptionGroup(parser, "Other", "Other options")
 
 other.add_option(
+    '--version', action="store_true", dest='showversion',
+    help="Print the version of the testrunner, and exit.")
+
+other.add_option(
     '-j', action="store", type="int", dest='processes',
     help="""\
 Use up to given number of parallel processes to execute tests.  May decrease
@@ -541,6 +547,12 @@
     options, positional = parser.parse_args(args[1:], defaults)
     options.original_testrunner_args = args
 
+    if options.showversion:
+        dist = pkg_resources.require('zope.testing')[0]
+        print 'zope.app.testrunner version %s' % dist.version
+        options.fail = True
+        return options
+
     if options.subunit:
         try:
             import subunit



More information about the Zope3-Checkins mailing list