diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2008-01-27 05:02:34 +0000 |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2008-01-27 05:02:34 +0000 |
commit | 46c61b2c1dc082da1ab016e74c7074c3b653a358 (patch) | |
tree | c5acc4074195e54640eef7f62c1718e8f4fe138b /Lib/test/test_resource.py | |
parent | 6e070814b232d663e222dec7252d8d187d7195ab (diff) | |
download | cpython-git-46c61b2c1dc082da1ab016e74c7074c3b653a358.tar.gz |
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.
Will backport.
Diffstat (limited to 'Lib/test/test_resource.py')
-rw-r--r-- | Lib/test/test_resource.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py index 3ff31bb33d..f7c2976add 100644 --- a/Lib/test/test_resource.py +++ b/Lib/test/test_resource.py @@ -54,8 +54,12 @@ class ResourceTest(unittest.TestCase): 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 |