]> granicus.if.org Git - python/commitdiff
Be sure to close the file. 2 places were deleting the file, so it was probably
authorNeal Norwitz <nnorwitz@gmail.com>
Tue, 1 Apr 2008 05:40:43 +0000 (05:40 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Tue, 1 Apr 2008 05:40:43 +0000 (05:40 +0000)
fine, but the last change may be required for the test to pass on Windows.
Should we always close the mmap too?

Lib/test/test_mmap.py

index 49ec78b842d906769a8bd41bee8fef2920da7c15..6fecaf565b295365b0cc5b1d778a5d52ccfc4f33 100644 (file)
@@ -161,6 +161,7 @@ class MmapTests(unittest.TestCase):
             pass
         else:
             self.fail("Able to resize readonly memory map")
+        f.close()
         del m, f
         self.assertEqual(open(TESTFN, "rb").read(), 'a'*mapsize,
                "Readonly memory map data file was modified")
@@ -217,6 +218,7 @@ class MmapTests(unittest.TestCase):
                "Copy-on-write test data file should not be modified.")
         # Ensuring copy-on-write maps cannot be resized
         self.assertRaises(TypeError, m.resize, 2*mapsize)
+        f.close()
         del m, f
 
         # Ensuring invalid access parameter raises exception
@@ -434,7 +436,7 @@ class MmapTests(unittest.TestCase):
         f = open(TESTFN, "rb")
         m = mmap.mmap(f.fileno(), mapsize, prot=mmap.PROT_READ)
         self.assertRaises(TypeError, m.write, "foo")
-
+        f.close()
 
     def test_error(self):
         self.assert_(issubclass(mmap.error, EnvironmentError))