summaryrefslogtreecommitdiffstats
path: root/Lib/test/regrtest.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-09-09 06:12:01 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-09-09 06:12:01 (GMT)
commita0a62225094a890c1b07ebc4f89e4c7c45c66b13 (patch)
tree147057adad1ae5b6548b708753a2febe91080d5f /Lib/test/regrtest.py
parent90ba8d9c80c4eba418ca2ddaefbf59c4acf00cf3 (diff)
downloadcpython-a0a62225094a890c1b07ebc4f89e4c7c45c66b13.zip
cpython-a0a62225094a890c1b07ebc4f89e4c7c45c66b13.tar.gz
cpython-a0a62225094a890c1b07ebc4f89e4c7c45c66b13.tar.bz2
Teach regrtest how to pass on doctest failure msgs. This is done via a
horridly inefficient hack in regrtest's Compare class, but it's about as clean as can be: regrtest has to set up the Compare instance before importing a test module, and by the time the module *is* imported it's too late to change that decision. The good news is that the more tests we convert to unittest and doctest, the less the inefficiency here matters. Even now there are few tests with large expected-output files (the new cost here is a Python-level call per .write() when there's an expected- output file).
Diffstat (limited to 'Lib/test/regrtest.py')
-rwxr-xr-xLib/test/regrtest.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 2c09f63..16d51ea 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -288,7 +288,7 @@ def runtest(test, generate, verbose, quiet, testdir = None):
elif verbose:
cfp = sys.stdout
else:
- cfp = Compare(outputfile)
+ cfp = Compare(outputfile, sys.stdout)
except IOError:
cfp = None
print "Warning: can't open", outputfile
@@ -386,7 +386,8 @@ def printlist(x, width=70, indent=4):
print line
class Compare:
- def __init__(self, filename):
+ def __init__(self, filename, origstdout):
+ self.origstdout = origstdout
if os.path.exists(filename):
self.fp = open(filename, 'r')
else:
@@ -395,6 +396,9 @@ class Compare:
self.stuffthatmatched = []
def write(self, data):
+ if test_support.suppress_output_comparison():
+ self.origstdout.write(data)
+ return
expected = self.fp.read(len(data))
if data == expected:
self.stuffthatmatched.append(expected)