[Zope3-checkins] SVN: zope.testing/trunk/src/zope/testing/testrunner Changed to adress different pdb behavior between Python 2.3 and 2.4.

Jim Fulton jim at zope.com
Thu Jun 30 09:31:47 EDT 2005


Log message for revision 30957:
  Changed to adress different pdb behavior between Python 2.3 and 2.4.
  (Also removed some machine-specific paths.)
  

Changed:
  U   zope.testing/trunk/src/zope/testing/testrunner-edge-cases.txt
  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-06-30 13:30:04 UTC (rev 30956)
+++ zope.testing/trunk/src/zope/testing/testrunner-edge-cases.txt	2005-06-30 13:31:46 UTC (rev 30957)
@@ -30,17 +30,17 @@
 
 Using pdb.set_trace in a function called by an ordinary test:
 
-    >>> sys.stdin = Input('n\np x\nc')
+    >>> if sys.version_info[:2] == (2, 3):
+    ...     sys.stdin = Input('n\np x\nc')
+    ... else:
+    ...     sys.stdin = Input('p x\nc')
     >>> sys.argv = ('test -ssample3 --tests-pattern ^sampletests_d$'
     ...             ' -t set_trace2').split()
     >>> try: testrunner.run(defaults)
     ... finally: sys.stdin = real_stdin
-    Running unit tests:
-    --Return--
-    > /usr/local/python/2.3.5/lib/python2.3/pdb.py(992)set_trace()->None
-    -> Pdb().set_trace()
-    (Pdb) n
-    > testrunner-ex/sample3/sampletests_d.py(42)f()
+    ... # doctest: +ELLIPSIS
+    Running unit tests:...
+    > testrunner-ex/sample3/sampletests_d.py(47)f()
     -> y = x
     (Pdb) p x
     1

Modified: zope.testing/trunk/src/zope/testing/testrunner.txt
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner.txt	2005-06-30 13:30:04 UTC (rev 30956)
+++ zope.testing/trunk/src/zope/testing/testrunner.txt	2005-06-30 13:31:46 UTC (rev 30957)
@@ -1517,23 +1517,30 @@
 
     >>> import sys
     >>> real_stdin = sys.stdin
-    >>> sys.stdin = Input('n\np x\nc')
+    >>> if sys.version_info[:2] == (2, 3):
+    ...     sys.stdin = Input('n\np x\nc')
+    ... else:
+    ...     sys.stdin = Input('p x\nc')
+
     >>> sys.argv = ('test -ssample3 --tests-pattern ^sampletests_d$'
     ...             ' -t set_trace1').split()
     >>> try: testrunner.run(defaults)
     ... finally: sys.stdin = real_stdin
-    Running unit tests:
-    --Return--
-    > /usr/local/python/2.3.5/lib/python2.3/pdb.py(992)set_trace()->None
-    -> Pdb().set_trace()
-    (Pdb) n
+    ... # doctest: +ELLIPSIS
+    Running unit tests:...
     > testrunner-ex/sample3/sampletests_d.py(27)test_set_trace1()
     -> y = x
     (Pdb) p x
     1
     (Pdb) c
-      Ran 1 tests with 0 failures and 0 errors in 0.002 seconds.
+      Ran 1 tests with 0 failures and 0 errors in 0.001 seconds.
 
+Note that, prior to Python 2.4, calling pdb.set_trace caused pdb to
+break in the pdb.set_trace function.  It was necessary to use 'next'
+or 'up' to get to the application code that called pdb.set_trace.  In
+Python 2.4, pdb.set_trace causes pdb to stop right after the call to
+pdb.set_trace. 
+
 You can also do post-mortem debugging, using the --post-mortem (-D)
 option:
 



More information about the Zope3-Checkins mailing list