diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2008-01-27 05:02:56 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2008-01-27 05:02:56 (GMT) |
commit | 61792348039db8f6d5700b3a92a5150e84a61a85 (patch) | |
tree | d4c6c62aaad577a9bbaae4b41852bbae298db3a3 | |
parent | ab577c1b32a09348aa0470df00cd4865b9e28a31 (diff) | |
download | cpython-61792348039db8f6d5700b3a92a5150e84a61a85.zip cpython-61792348039db8f6d5700b3a92a5150e84a61a85.tar.gz cpython-61792348039db8f6d5700b3a92a5150e84a61a85.tar.bz2 |
Backport 60342:
Try to prevent this test from being flaky. We might need a sleep in here
which isn't as bad as it sounds. The close() *should* raise an exception,
so if it didn't we should give more time to sync and really raise it.
-rw-r--r-- | Lib/test/test_resource.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py index 28876e3..86c7cc2 100644 --- a/Lib/test/test_resource.py +++ b/Lib/test/test_resource.py @@ -37,8 +37,11 @@ try: f.write("Y") f.flush() # On some systems (e.g., Ubuntu on hppa) the flush() - # doesn't cause the exception, but the close() does. - f.close() + # doesn't always cause the exception, but the close() + # does eventually. Try closing several times in an attempt + # to ensure the file is really synced and the exception raised. + for i in range(5): + f.close() except IOError: if not limit_set: raise |