Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit af82a7e

Browse files
committed
In lieu of harness rewrite, fixed problem with test_thread ImportError
triggering a bogus TestFailed exception.
1 parent 4a48809 commit af82a7e

1 file changed

Lines changed: 14 additions & 17 deletions

File tree

Lib/test/autotest.py

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,15 @@ def do_one_test(t, outdir):
108108
if warn:
109109
sys.stderr.write(msg+': Un-installed'
110110
' optional module?\n')
111+
try:
112+
fake_stdout.close()
113+
except TestFailed:
114+
pass
115+
fake_stdout = None
111116
finally:
112117
sys.stdout = real_stdout
113-
fake_stdout.close()
118+
if fake_stdout:
119+
fake_stdout.close()
114120

115121

116122

@@ -139,26 +145,17 @@ def main():
139145
else:
140146
import testall
141147
tests = testall.tests
142-
failed = []
143-
missing = []
148+
failed = 0
144149
for test in tests:
150+
print 'testing:', test
145151
try:
146152
do_one_test(test, outdir)
147153
except TestFailed, msg:
148-
traceback.print_exc()
149-
failed.append(test)
150-
except TestMissing:
151-
missing.append(test)
152-
print '**********\n* Report *\n**********'
153-
if not failed and not missing:
154+
print 'test', test, 'failed'
155+
failed = failed + 1
156+
if not failed:
154157
print 'All tests OK.'
155-
if failed:
156-
print 'Failed tests:'
157-
for t in failed:
158-
print ' ', t
159-
if missing:
160-
print 'Missing tests:'
161-
for t in missing:
162-
print ' ', t
158+
else:
159+
print failed, 'tests failed'
163160

164161
main()

0 commit comments

Comments
 (0)