diff options
author | Fred Drake <fdrake@acm.org> | 2001-05-21 21:08:12 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2001-05-21 21:08:12 (GMT) |
commit | ae1bb176bea47b2123bba208733edb42692e9431 (patch) | |
tree | 87ac3912d54a6eeac4f2e42958bc2a9f20a75d6f /Lib/test | |
parent | 62686696123eb82df5f688b9a3906b9b648ce220 (diff) | |
download | cpython-ae1bb176bea47b2123bba208733edb42692e9431.zip cpython-ae1bb176bea47b2123bba208733edb42692e9431.tar.gz cpython-ae1bb176bea47b2123bba208733edb42692e9431.tar.bz2 |
If the file containing expected output does not exist, assume that it
contains a single line of text giving the name of the output file. This
covers all tests that do not actually produce any output in the test code.
Diffstat (limited to 'Lib/test')
-rwxr-xr-x | Lib/test/regrtest.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index ffa67f1..c77abc3 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -37,6 +37,7 @@ import os import getopt import traceback import random +import StringIO import test_support @@ -284,7 +285,11 @@ def count(n, word): class Compare: def __init__(self, filename): - self.fp = open(filename, 'r') + if os.path.exists(filename): + self.fp = open(filename, 'r') + else: + self.fp = StringIO.StringIO( + os.path.basename(filename) + "\n") self.stuffthatmatched = [] def write(self, data): |