]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
If the file containing expected output does not exist, assume that it
authorFred Drake <fdrake@acm.org>
Mon, 21 May 2001 21:08:12 +0000 (21:08 +0000)
committerFred Drake <fdrake@acm.org>
Mon, 21 May 2001 21:08:12 +0000 (21:08 +0000)
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.

Lib/test/regrtest.py

index ffa67f1b41fd65bd21392c66b15d3b8957f795d6..c77abc34a30309697bc81910351facb912a159be 100755 (executable)
@@ -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):