]> granicus.if.org Git - python/commitdiff
Always try to remove the test file even if close raises an exception
authorNeal Norwitz <nnorwitz@gmail.com>
Sat, 26 Jan 2008 21:02:45 +0000 (21:02 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Sat, 26 Jan 2008 21:02:45 +0000 (21:02 +0000)
Lib/test/test_resource.py

index 16e360f1a8bf91c302ddc8412d8e49281f066eb2..09ac4d53ca7bb3313c90a2320def00b8e12c93fe 100644 (file)
@@ -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:
@@ -63,10 +62,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