Commit da17b9c8 authored by Jeremy Hylton's avatar Jeremy Hylton

fix bug #42 reported by Andrew Dalke

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
parent 40779337
...@@ -3,4 +3,3 @@ long / * % divmod ...@@ -3,4 +3,3 @@ long / * % divmod
long bit-operation identities long bit-operation identities
long str/hex/oct/atol long str/hex/oct/atol
long miscellaneous operations long miscellaneous operations
...@@ -2,4 +2,3 @@ test_popen2 ...@@ -2,4 +2,3 @@ test_popen2
testing popen2... testing popen2...
testing popen3... testing popen3...
All OK All OK
test_select 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
...@@ -212,6 +212,8 @@ def runtest(test, generate, verbose, testdir = None): ...@@ -212,6 +212,8 @@ def runtest(test, generate, verbose, testdir = None):
sys.stdout = cfp sys.stdout = cfp
print test # Output file starts with test name print test # Output file starts with test name
__import__(test, globals(), locals(), []) __import__(test, globals(), locals(), [])
if cfp and not (generate or verbose):
cfp.close()
finally: finally:
sys.stdout = save_stdout sys.stdout = save_stdout
except ImportError, msg: except ImportError, msg:
......
...@@ -45,7 +45,6 @@ def test(): ...@@ -45,7 +45,6 @@ def test():
if verbose: if verbose:
print 'timeout =', tout print 'timeout =', tout
rfd, wfd, xfd = select.select([p], [], [], tout) rfd, wfd, xfd = select.select([p], [], [], tout)
## print rfd, wfd, xfd
if (rfd, wfd, xfd) == ([], [], []): if (rfd, wfd, xfd) == ([], [], []):
continue continue
if (rfd, wfd, xfd) == ([p], [], []): if (rfd, wfd, xfd) == ([p], [], []):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment