[Zope3-checkins] CVS: Zope3 - test.py:1.87

Jim Fulton jim at zope.com
Mon Mar 15 15:42:09 EST 2004


Update of /cvs-repository/Zope3
In directory cvs.zope.org:/tmp/cvs-serv2995

Modified Files:
	test.py 
Log Message:
Added basic post-mortem-debugging support for doctests. Only
unexpected exceptions are handled. We still need to think about how to
handle debugging mismatched output.

I'm not very happy with the way this is done now. But it works.


=== Zope3/test.py 1.86 => 1.87 ===
--- Zope3/test.py:1.86	Mon Mar  8 12:42:11 2004
+++ Zope3/test.py	Mon Mar 15 15:41:38 2004
@@ -348,6 +348,8 @@
                                    count=self._count, progress=self._progress)
 
     def run(self, test):
+        if self._debug:
+            club_debug(test)
         self._count = test.countTestCases()
         if self._profile:
             prof = hotshot.Profile("tests_profile.prof")
@@ -359,6 +361,15 @@
             stats.print_stats(50)
             return r
         return unittest.TextTestRunner.run(self, test)
+
+def club_debug(test):
+    # Beat a debug flag into debug-aware test cases
+    setDebugModeOn = getattr(test, 'setDebugModeOn', None)
+    if setDebugModeOn is not None:
+        setDebugModeOn()
+        
+    for subtest in getattr(test, '_tests', ()):
+        club_debug(subtest)
 
 # setup list of directories to put on the path
 class PathInit:




More information about the Zope3-Checkins mailing list