[Python-checkins] python/dist/src/Lib doctest.py, 1.36.2.10,
1.36.2.11
tim_one at users.sourceforge.net
tim_one at users.sourceforge.net
Tue Aug 3 23:22:44 CEST 2004
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15491/Lib
Modified Files:
Tag: tim-doctest-branch
doctest.py
Log Message:
debug_script(): Reverted the change to use a fancy tempfile class. It
was "a feature" that the debugging script was left behind, and the
semantics of the Windows-specific O_TEMPORARY are such that test_doctest
failed with a filesystem permission error when it tried to test this.
Index: doctest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/doctest.py,v
retrieving revision 1.36.2.10
retrieving revision 1.36.2.11
diff -C2 -d -r1.36.2.10 -r1.36.2.11
*** doctest.py 3 Aug 2004 20:09:51 -0000 1.36.2.10
--- doctest.py 3 Aug 2004 21:22:41 -0000 1.36.2.11
***************
*** 739,743 ****
# Find a test for this object, and add it to the list of tests.
test = self._get_test(obj, name, module, source_lines)
! if test is not None:
tests.append(test)
--- 739,743 ----
# Find a test for this object, and add it to the list of tests.
test = self._get_test(obj, name, module, source_lines)
! if test is not None:
tests.append(test)
***************
*** 981,985 ****
# Handle the common case first, for efficiency:
# if they're string-identical, always return true.
! if got == want:
return True
--- 981,985 ----
# Handle the common case first, for efficiency:
# if they're string-identical, always return true.
! if got == want:
return True
***************
*** 1010,1014 ****
got = ' '.join(got.split())
want = ' '.join(want.split())
! if got == want:
return True
--- 1010,1014 ----
got = ' '.join(got.split())
want = ' '.join(want.split())
! if got == want:
return True
***************
*** 1040,1044 ****
if not (self._optionflags & DONT_ACCEPT_BLANKLINE):
want = re.sub('(?m)^%s$' % re.escape(BLANKLINE_MARKER), '', want)
!
# Check if we should use diff. Don't use diff if the actual
# or expected outputs are too short, or if the expected output
--- 1040,1044 ----
if not (self._optionflags & DONT_ACCEPT_BLANKLINE):
want = re.sub('(?m)^%s$' % re.escape(BLANKLINE_MARKER), '', want)
!
# Check if we should use diff. Don't use diff if the actual
# or expected outputs are too short, or if the expected output
***************
*** 1764,1771 ****
import pdb
! srcfile = tempfile.NamedTemporaryFile(prefix='doctestdebug-',
! suffix='.py', mode="w")
! srcfile.write(src)
! srcfile.flush()
if globs:
globs = globs.copy()
--- 1764,1772 ----
import pdb
! srcfilename = tempfile.mktemp("doctestdebug.py")
! f = open(srcfilename, 'w')
! f.write(src)
! f.close()
!
if globs:
globs = globs.copy()
***************
*** 1773,1789 ****
globs = {}
! try:
! if pm:
! try:
! execfile(srcfile.name, globs, globs)
! except:
! print sys.exc_info()[1]
! pdb.post_mortem(sys.exc_info()[2])
! else:
! # Note that %r is vital here. '%s' instead can, e.g., cause
! # backslashes to get treated as metacharacters on Windows.
! pdb.run("execfile(%r)" % srcfile.name, globs, globs)
! finally:
! srcfile.close() # Automatically deletes the file.
def debug(module, name, pm=False):
--- 1774,1787 ----
globs = {}
! if pm:
! try:
! execfile(srcfilename, globs, globs)
! except:
! print sys.exc_info()[1]
! pdb.post_mortem(sys.exc_info()[2])
! else:
! # Note that %r is vital here. '%s' instead can, e.g., cause
! # backslashes to get treated as metacharacters on Windows.
! pdb.run("execfile(%r)" % srcfilename, globs, globs)
def debug(module, name, pm=False):
More information about the Python-checkins
mailing list