diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2008-01-27 20:08:04 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2008-01-27 20:08:04 (GMT) |
commit | 209ea39d31288c7446601c583bbb7ed55bb2a3d9 (patch) | |
tree | de4f7ddae290e8d2e7d068fb478e5a3642e1cf47 | |
parent | 0b11c5fdf60b22eeed3d77dd31cbd63c6e2e2f12 (diff) | |
download | cpython-209ea39d31288c7446601c583bbb7ed55bb2a3d9.zip cpython-209ea39d31288c7446601c583bbb7ed55bb2a3d9.tar.gz cpython-209ea39d31288c7446601c583bbb7ed55bb2a3d9.tar.bz2 |
Sync up with trunk. Try to flush repeatedly to ensure the exception is raised.
-rw-r--r-- | Lib/test/test_resource.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py index 86c7cc2..ac95395 100644 --- a/Lib/test/test_resource.py +++ b/Lib/test/test_resource.py @@ -1,7 +1,7 @@ import os import resource -from test.test_support import TESTFN +from test.test_support import TESTFN, unlink # This test is checking a few specific problem spots. RLIMIT_FSIZE # should be RLIM_INFINITY, which will be a really big number on a @@ -38,17 +38,19 @@ try: f.flush() # On some systems (e.g., Ubuntu on hppa) the flush() # doesn't always cause the exception, but the close() - # does eventually. Try closing several times in an attempt + # does eventually. Try flushing several times in an attempt # to ensure the file is really synced and the exception raised. for i in range(5): - f.close() + time.sleep(.1) + f.flush() except IOError: if not limit_set: raise f.close() - os.unlink(TESTFN) finally: - resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max)) + if limit_set: + resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max)) + unlink(TESTFN) # And be sure that setrlimit is checking for really large values too_big = 10L**50 |