[Python-checkins] r62085 - python/trunk/Lib/test/test_mmap.py

neal.norwitz python-checkins at python.org
Tue Apr 1 07:40:44 CEST 2008


Author: neal.norwitz
Date: Tue Apr  1 07:40:43 2008
New Revision: 62085

Modified:
   python/trunk/Lib/test/test_mmap.py
Log:
Be sure to close the file.  2 places were deleting the file, so it was probably
fine, but the last change may be required for the test to pass on Windows.
Should we always close the mmap too?


Modified: python/trunk/Lib/test/test_mmap.py
==============================================================================
--- python/trunk/Lib/test/test_mmap.py	(original)
+++ python/trunk/Lib/test/test_mmap.py	Tue Apr  1 07:40:43 2008
@@ -161,6 +161,7 @@
             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 @@
                "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 @@
         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))


More information about the Python-checkins mailing list