Commit 12adef9b authored by Nick Coghlan's avatar Nick Coghlan

Try to get rid of spurious failure in test_resource on the Debian buildbots by...

Try to get rid of spurious failure in test_resource on the Debian buildbots by changing the file size limit before attempting to close the file
parent 13c25c08
......@@ -49,6 +49,7 @@ class ResourceTest(unittest.TestCase):
except ValueError:
limit_set = False
f = open(test_support.TESTFN, "wb")
try:
f.write("X" * 1024)
try:
f.write("Y")
......@@ -56,9 +57,15 @@ class ResourceTest(unittest.TestCase):
except IOError:
if not limit_set:
raise
if limit_set:
# Close will attempt to flush the byte we wrote
# Restore limit first to avoid getting a spurious error
resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max))
finally:
f.close()
os.unlink(test_support.TESTFN)
finally:
if limit_set:
resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max))
def test_fsize_toobig(self):
......
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