summaryrefslogtreecommitdiff
path: root/Lib/test/test_mmap.py
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2008-04-01 05:40:43 +0000
committerNeal Norwitz <nnorwitz@gmail.com>2008-04-01 05:40:43 +0000
commitd48a2f77f01641ed806379358bd88eaf9e7644c8 (patch)
treea7a93b5f6b22964b759e28f98bcd3f2b51a72a8a /Lib/test/test_mmap.py
parent092a1f7ad7140095ca9f722333c2c667674d1e8b (diff)
downloadcpython-git-d48a2f77f01641ed806379358bd88eaf9e7644c8.tar.gz
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?
Diffstat (limited to 'Lib/test/test_mmap.py')
-rw-r--r--Lib/test/test_mmap.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py
index 49ec78b842..6fecaf565b 100644
--- a/Lib/test/test_mmap.py
+++ b/Lib/test/test_mmap.py
@@ -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))