diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py index 28876e3a211..86c7cc206ab 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