Be more careful with the shuffling of stdout.

This commit is contained in:
Guido van Rossum 1996-12-11 16:54:54 +00:00
parent 50c5cf132a
commit dbfed710a1
1 changed files with 7 additions and 6 deletions

View File

@ -89,12 +89,13 @@ def usage(status):
def do_one_test(t, outdir): def do_one_test(t, outdir):
filename = os.path.join(outdir, t) filename = os.path.join(outdir, t)
real_stdout = sys.stdout real_stdout = sys.stdout
if generate:
print 'Generating:', filename
fake_stdout = open(filename, 'w')
else:
fake_stdout = Compare(filename)
try: try:
if generate: sys.stdout = fake_stdout
print 'Generating:', filename
sys.stdout = open(filename, 'w')
else:
sys.stdout = Compare(filename)
print t print t
unload(t) unload(t)
try: try:
@ -104,8 +105,8 @@ def do_one_test(t, outdir):
sys.stderr.write(msg+': Un-installed' sys.stderr.write(msg+': Un-installed'
' optional module?\n') ' optional module?\n')
finally: finally:
sys.stdout.close()
sys.stdout = real_stdout sys.stdout = real_stdout
fake_stdout.close()