[Python-checkins] python/dist/src/Lib/test test_doctest.py, 1.14,
1.15
tim_one at users.sourceforge.net
tim_one at users.sourceforge.net
Mon Aug 9 17:43:49 CEST 2004
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22785/Lib/test
Modified Files:
test_doctest.py
Log Message:
This started as a spelling and whitespace cleanup. The comment for
the set_trace fiddling didn't make sense to me, and I ended up reworking
that part of the code. We really do want to save and restore
pdb.set_trace, so that each dynamically nested level of doctest gets
sys.stdout fiddled to what's appropriate for *it*. The only "trick"
really needed is that these layers of set_trace wrappers each call the
original pdb.set_trace (instead of the current pdb.set_trace).
Index: test_doctest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_doctest.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** test_doctest.py 9 Aug 2004 11:34:47 -0000 1.14
--- test_doctest.py 9 Aug 2004 15:43:47 -0000 1.15
***************
*** 988,996 ****
r"""Using pdb.set_trace from a doctest
! You can use pdb.set_trace from a doctest. To do so, you must
retrieve the set_trace function from the pdb module at the time
! you use it. The doctest module changes sys,stdout so that it can
! capture program output. It also temporarily replaces pdb.set_trace
! with a version that restores stdout. This is necessary for you to
see debugger output.
--- 988,996 ----
r"""Using pdb.set_trace from a doctest
! You can use pdb.set_trace from a doctest. To do so, you must
retrieve the set_trace function from the pdb module at the time
! you use it. The doctest module changes sys.stdout so that it can
! capture program output. It also temporarily replaces pdb.set_trace
! with a version that restores stdout. This is necessary for you to
see debugger output.
***************
*** 1042,1047 ****
... '''
>>> test = doctest.DocTest(doc, globals(), "foo", "foo.py", 0)
!
! >>> import tempfile
>>> fake_stdin = tempfile.TemporaryFile(mode='w+')
>>> fake_stdin.write('\n'.join([
--- 1042,1046 ----
... '''
>>> test = doctest.DocTest(doc, globals(), "foo", "foo.py", 0)
!
>>> fake_stdin = tempfile.TemporaryFile(mode='w+')
>>> fake_stdin.write('\n'.join([
More information about the Python-checkins
mailing list