Kaydet (Commit) cffcfed1 authored tarafından Tim Peters's avatar Tim Peters

New test code failed to close the file. This caused

test_file to fail on Windows in reality (can't delete
a still-open file), but a new bare "except:" hid that
test_file failed on Windows, and leaving behind the
still-open TESTFN caused a cascade of bogus failures
in later tests.

So, close the file, and stop hiding failure to unlink.
üst 967aa8b3
...@@ -323,18 +323,17 @@ try: ...@@ -323,18 +323,17 @@ try:
"failed. Got %r, expected %r" % (line, testline)) "failed. Got %r, expected %r" % (line, testline))
# Reading after iteration hit EOF shouldn't hurt either # Reading after iteration hit EOF shouldn't hurt either
f = open(TESTFN) f = open(TESTFN)
for line in f:
pass
try: try:
f.readline() for line in f:
f.readinto(buf) pass
f.read() try:
f.readlines() f.readline()
except ValueError: f.readinto(buf)
raise TestFailed("read* failed after next() consumed file") f.read()
f.readlines()
except ValueError:
raise TestFailed("read* failed after next() consumed file")
finally:
f.close()
finally: finally:
# Bare 'except' so as not to mask errors in the test os.unlink(TESTFN)
try:
os.unlink(TESTFN)
except:
pass
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