[Zope3-checkins] SVN: zope.testing/trunk/src/zope/testing/testrunner Fixed a bug in handlint triple-verbose output on combination with

Jim Fulton jim at zope.com
Mon Jul 25 10:33:26 EDT 2005


Log message for revision 37407:
  Fixed a bug in handlint triple-verbose output on combination with
  post-mortem debugging.  Also, made post-mortem debugging act more like
  normal test runs wrt it's interaction with the test result.
  

Changed:
  U   zope.testing/trunk/src/zope/testing/testrunner-edge-cases.txt
  U   zope.testing/trunk/src/zope/testing/testrunner.py
  U   zope.testing/trunk/src/zope/testing/testrunner.txt

-=-
Modified: zope.testing/trunk/src/zope/testing/testrunner-edge-cases.txt
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-edge-cases.txt	2005-07-25 14:27:07 UTC (rev 37406)
+++ zope.testing/trunk/src/zope/testing/testrunner-edge-cases.txt	2005-07-25 14:33:26 UTC (rev 37407)
@@ -365,3 +365,25 @@
     1
     (Pdb) c
     True
+
+Post-mortem debugging with tripple verbosity
+
+    >>> sys.argv = 'test --layer samplelayers.Layer1$ -vvv -D'.split()
+    >>> testrunner.run(defaults)
+    Running tests at level 1
+    Running samplelayers.Layer1 tests:
+      Set up samplelayers.Layer1 in 0.000 seconds.
+      Running:
+        test_x1 (sampletestsf.TestA1) (0.000 ms)
+        test_y0 (sampletestsf.TestA1) (0.000 ms)
+        test_z0 (sampletestsf.TestA1) (0.000 ms)
+        test_x0 (sampletestsf.TestB1) (0.000 ms)
+        test_y1 (sampletestsf.TestB1) (0.000 ms)
+        test_z0 (sampletestsf.TestB1) (0.000 ms)
+        test_1 (sampletestsf.TestNotMuch1) (0.000 ms)
+        test_2 (sampletestsf.TestNotMuch1) (0.000 ms)
+        test_3 (sampletestsf.TestNotMuch1) (0.000 ms)
+      Ran 9 tests with 0 failures and 0 errors in 0.001 seconds.
+    Tearing down left over layers:
+      Tear down samplelayers.Layer1 in 0.000 seconds.
+    False

Modified: zope.testing/trunk/src/zope/testing/testrunner.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner.py	2005-07-25 14:27:07 UTC (rev 37406)
+++ zope.testing/trunk/src/zope/testing/testrunner.py	2005-07-25 14:33:26 UTC (rev 37407)
@@ -219,15 +219,20 @@
         if options.post_mortem:
             # post-mortem debugging
             for test in tests:
+                result.startTest(test)
                 try:
-                    test.debug()
-                except:
-                    result.addError(
-                        test,
-                        sys.exc_info()[:2] + (sys.exc_info()[2].tb_next, ),
-                        )
-                else:
-                    result.addSuccess(test)
+                    try:
+                        test.debug()
+                    except:
+                        result.addError(
+                            test,
+                            sys.exc_info()[:2] + (sys.exc_info()[2].tb_next, ),
+                            )
+                    else:
+                        result.addSuccess(test)
+                finally:
+                    result.stopTest(test)
+                    
         else:
             # normal
             tests(result)

Modified: zope.testing/trunk/src/zope/testing/testrunner.txt
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner.txt	2005-07-25 14:27:07 UTC (rev 37406)
+++ zope.testing/trunk/src/zope/testing/testrunner.txt	2005-07-25 14:33:26 UTC (rev 37407)
@@ -1745,12 +1745,12 @@
     >>> testrunner.run(defaults)
     Running sample1.sampletests_ntd.Layer tests:
       Set up sample1.sampletests_ntd.Layer in N.NNN seconds.
-      Ran 0 tests with 0 failures and 0 errors in N.NNN seconds.
+      Ran 1 tests with 0 failures and 0 errors in N.NNN seconds.
     Running sample2.sampletests_ntd.Layer tests:
       Tear down sample1.sampletests_ntd.Layer ... not supported
     Running sample2.sampletests_ntd.Layer tests:
       Set up sample2.sampletests_ntd.Layer in N.NNN seconds.
-      Ran 0 tests with 0 failures and 0 errors in N.NNN seconds.
+      Ran 1 tests with 0 failures and 0 errors in N.NNN seconds.
     Running sample3.sampletests_ntd.Layer tests:
       Tear down sample2.sampletests_ntd.Layer ... not supported
     Running sample3.sampletests_ntd.Layer tests:
@@ -1807,10 +1807,10 @@
     Can't post-mortem debug when running a layer as a subprocess!
     **********************************************************************
     <BLANKLINE>
-      Ran 0 tests with 0 failures and 4 errors in N.NNN seconds.
+      Ran 6 tests with 0 failures and 4 errors in N.NNN seconds.
     Tearing down left over layers:
       Tear down sample3.sampletests_ntd.Layer ... not supported
-    Total: 0 tests, 0 failures, 4 errors
+    Total: 8 tests, 0 failures, 4 errors
     True
 
 Similarly, pdb.set_trace doesn't work when running tests in a layer



More information about the Zope3-Checkins mailing list