summaryrefslogtreecommitdiff
path: root/Lib/test/test_resource.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_resource.py')
-rw-r--r--Lib/test/test_resource.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py
index 1216560776..987c8d72fe 100644
--- a/Lib/test/test_resource.py
+++ b/Lib/test/test_resource.py
@@ -15,7 +15,6 @@ class ResourceTest(unittest.TestCase):
self.assertRaises(TypeError, resource.setrlimit, 42, 42, 42)
def test_fsize_ismax(self):
-
try:
(cur, max) = resource.getrlimit(resource.RLIMIT_FSIZE)
except AttributeError:
@@ -54,6 +53,13 @@ class ResourceTest(unittest.TestCase):
try:
f.write(b"Y")
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 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
@@ -63,10 +69,10 @@ class ResourceTest(unittest.TestCase):
resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max))
finally:
f.close()
- os.unlink(test_support.TESTFN)
finally:
if limit_set:
resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max))
+ test_support.unlink(test_support.TESTFN)
def test_fsize_toobig(self):
# Be sure that setrlimit is checking for really large values