]> granicus.if.org Git - python/commitdiff
fix bug #42 reported by Andrew Dalke
authorJeremy Hylton <jeremy@alum.mit.edu>
Tue, 11 Jul 2000 15:15:31 +0000 (15:15 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Tue, 11 Jul 2000 15:15:31 +0000 (15:15 +0000)
The Compare close contains a close method that checks to see if there
is any unconsumed data in the Compare instance; i.e. if the canonical
output file contains more data than was produced by the current test
run. This method was never called, allowing differences to go
undetected.

Fix is to call close after the test is run (after __import__)

output/test_long and output/test_popen2 needed trivial changes
output/test_select contained lots of text, but test_select.py produced
    no output

Lib/test/output/test_long
Lib/test/output/test_popen2
Lib/test/output/test_select
Lib/test/regrtest.py
Lib/test/test_select.py

index 41ecbce7dd4a43b0654aa1d58db4f37eece96152..452826450bdf1e022823d4e37911c0d9195ec25e 100644 (file)
@@ -3,4 +3,3 @@ long / * % divmod
 long bit-operation identities
 long str/hex/oct/atol
 long miscellaneous operations
-
index e13034d01105a58ea284c05ecb2fc409d47b21e2..1fadf1b99f6311a23dcbdfc8e2ae44f0dc3c844a 100644 (file)
@@ -2,4 +2,3 @@ test_popen2
 testing popen2...
 testing popen3...
 All OK
-
index d731e0afb427098fd815d057c3ea3dba9a0b8333..e8d0cb5e447cc8434134c89fbbaf13db86678a62 100644 (file)
@@ -1,25 +1 @@
 test_select
-timeout = 0
-timeout = 1
-'testing...\012'
-timeout = 2
-'testing...\012'
-timeout = 4
-'testing...\012'
-timeout = 8
-'testing...\012'
-timeout = 16
-'testing...\012'
-timeout = None
-'testing...\012'
-timeout = None
-'testing...\012'
-timeout = None
-'testing...\012'
-timeout = None
-'testing...\012'
-timeout = None
-'testing...\012'
-timeout = None
-''
-EOF
index 27b2b03955f0e572df3e0b9cc3cf498832056fcd..dbaee7562469c6dc3ceb90bc606e5cf27a43e53f 100755 (executable)
@@ -212,6 +212,8 @@ def runtest(test, generate, verbose, testdir = None):
                 sys.stdout = cfp
                 print test              # Output file starts with test name
             __import__(test, globals(), locals(), [])
+            if cfp and not (generate or verbose):
+                cfp.close()
         finally:
             sys.stdout = save_stdout
     except ImportError, msg:
index 60de3600bc214c003b7c9c7648e259b591f03091..1a7bf4b86230c4da97eb820a753e2f20de7bb411 100644 (file)
@@ -45,7 +45,6 @@ def test():
                 if verbose:
                         print 'timeout =', tout
                 rfd, wfd, xfd = select.select([p], [], [], tout)
-##              print rfd, wfd, xfd
                 if (rfd, wfd, xfd) == ([], [], []):
                         continue
                 if (rfd, wfd, xfd) == ([p], [], []):