[Python-checkins] r60342 - python/trunk/Lib/test/test_resource.py

neal.norwitz python-checkins at python.org
Sun Jan 27 06:02:35 CET 2008


Author: neal.norwitz
Date: Sun Jan 27 06:02:34 2008
New Revision: 60342

Modified:
   python/trunk/Lib/test/test_resource.py
Log:
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.


Modified: python/trunk/Lib/test/test_resource.py
==============================================================================
--- python/trunk/Lib/test/test_resource.py	(original)
+++ python/trunk/Lib/test/test_resource.py	Sun Jan 27 06:02:34 2008
@@ -54,8 +54,12 @@
                         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


More information about the Python-checkins mailing list