[Zope3-checkins] SVN: zope.testing/trunk/ LP #399394: Added a ``--stop-on-error`` option to the testrunner.

Tres Seaver tseaver at palladion.com
Sat Apr 10 21:33:03 EDT 2010


Log message for revision 110730:
  LP #399394:  Added a ``--stop-on-error`` option to the testrunner.
  
  The option can also be invoked as ``--stop`` or ``-x``.
  

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

-=-
Modified: zope.testing/trunk/CHANGES.txt
===================================================================
--- zope.testing/trunk/CHANGES.txt	2010-04-11 01:15:16 UTC (rev 110729)
+++ zope.testing/trunk/CHANGES.txt	2010-04-11 01:33:03 UTC (rev 110730)
@@ -4,6 +4,9 @@
 3.9.4 (unreleased)
 ==================
 
+- LP #399394:  Added a ``--stop-on-error`` / ``--stop`` / ``-x`` option to
+  the testrunner.
+
 - LP #498162:  Added a ``--pdb`` alias for the existing ``--post-mortem``
   / ``-D`` option to the testrunner.
 

Modified: zope.testing/trunk/src/zope/testing/testrunner/options.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner/options.py	2010-04-11 01:15:16 UTC (rev 110729)
+++ zope.testing/trunk/src/zope/testing/testrunner/options.py	2010-04-11 01:33:03 UTC (rev 110730)
@@ -255,6 +255,12 @@
 
 
 analysis.add_option(
+    '--stop-on-error', '--stop', '-x', action="store_true",
+    dest='stop_on_error',
+    help="Stop running tests after first test failure or error."
+    )
+
+analysis.add_option(
     '--post-mortem', '--pdb', '-D', action="store_true", dest='post_mortem',
     help="Enable post-mortem debugging of test failures"
     )

Modified: zope.testing/trunk/src/zope/testing/testrunner/runner.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner/runner.py	2010-04-11 01:15:16 UTC (rev 110729)
+++ zope.testing/trunk/src/zope/testing/testrunner/runner.py	2010-04-11 01:33:03 UTC (rev 110730)
@@ -711,6 +711,8 @@
                                                       " as a subprocess!")
             else:
                 zope.testing.testrunner.debug.post_mortem(exc_info)
+        elif self.options.stop_on_error:
+            self.stop()
 
     def addFailure(self, test, exc_info):
         self.options.output.test_failure(test, time.time() - self._start_time,
@@ -722,6 +724,8 @@
             # XXX: mgedmin: why isn't there a resume_layer check here like
             # in addError?
             zope.testing.testrunner.debug.post_mortem(exc_info)
+        elif self.options.stop_on_error:
+            self.stop()
 
     def stopTest(self, test):
         self.testTearDown()



More information about the Zope3-Checkins mailing list