In lieu of harness rewrite, fixed problem with test_thread ImportError

triggering a bogus TestFailed exception.
This commit is contained in:
Barry Warsaw 1996-12-18 16:39:31 +00:00
parent 4a4880966b
commit af82a7ef49
1 changed files with 14 additions and 17 deletions

View File

@ -108,9 +108,15 @@ def do_one_test(t, outdir):
if warn: if warn:
sys.stderr.write(msg+': Un-installed' sys.stderr.write(msg+': Un-installed'
' optional module?\n') ' optional module?\n')
try:
fake_stdout.close()
except TestFailed:
pass
fake_stdout = None
finally: finally:
sys.stdout = real_stdout sys.stdout = real_stdout
fake_stdout.close() if fake_stdout:
fake_stdout.close()
@ -139,26 +145,17 @@ def main():
else: else:
import testall import testall
tests = testall.tests tests = testall.tests
failed = [] failed = 0
missing = []
for test in tests: for test in tests:
print 'testing:', test
try: try:
do_one_test(test, outdir) do_one_test(test, outdir)
except TestFailed, msg: except TestFailed, msg:
traceback.print_exc() print 'test', test, 'failed'
failed.append(test) failed = failed + 1
except TestMissing: if not failed:
missing.append(test)
print '**********\n* Report *\n**********'
if not failed and not missing:
print 'All tests OK.' print 'All tests OK.'
if failed: else:
print 'Failed tests:' print failed, 'tests failed'
for t in failed:
print ' ', t
if missing:
print 'Missing tests:'
for t in missing:
print ' ', t
main() main()