[pypy-svn] r78492 - pypy/branch/fast-forward/lib-python/modified-2.7.0/test
afa at codespeak.net
afa at codespeak.net
Fri Oct 29 23:41:28 CEST 2010
Author: afa
Date: Fri Oct 29 23:41:26 2010
New Revision: 78492
Added:
pypy/branch/fast-forward/lib-python/modified-2.7.0/test/test_mmap.py
- copied, changed from r78483, pypy/branch/fast-forward/lib-python/2.7.0/test/test_mmap.py
Log:
Flush data before reopening the same file
Copied: pypy/branch/fast-forward/lib-python/modified-2.7.0/test/test_mmap.py (from r78483, pypy/branch/fast-forward/lib-python/2.7.0/test/test_mmap.py)
==============================================================================
--- pypy/branch/fast-forward/lib-python/2.7.0/test/test_mmap.py (original)
+++ pypy/branch/fast-forward/lib-python/modified-2.7.0/test/test_mmap.py Fri Oct 29 23:41:26 2010
@@ -118,7 +118,8 @@
def test_access_parameter(self):
# Test for "access" keyword parameter
mapsize = 10
- open(TESTFN, "wb").write("a"*mapsize)
+ with open(TESTFN, "wb") as f:
+ f.write("a"*mapsize)
f = open(TESTFN, "rb")
m = mmap.mmap(f.fileno(), mapsize, access=mmap.ACCESS_READ)
self.assertEqual(m[:], 'a'*mapsize, "Readonly memory map data incorrect.")
@@ -494,7 +495,8 @@
if not hasattr(mmap, 'PROT_READ'):
return
mapsize = 10
- open(TESTFN, "wb").write("a"*mapsize)
+ with open(TESTFN, "wb") as f:
+ f.write("a"*mapsize)
f = open(TESTFN, "rb")
m = mmap.mmap(f.fileno(), mapsize, prot=mmap.PROT_READ)
self.assertRaises(TypeError, m.write, "foo")
@@ -506,7 +508,8 @@
def test_io_methods(self):
data = "0123456789"
- open(TESTFN, "wb").write("x"*len(data))
+ with open(TESTFN, "wb") as f:
+ f.write("x"*len(data))
f = open(TESTFN, "r+b")
m = mmap.mmap(f.fileno(), len(data))
f.close()
More information about the Pypy-commit
mailing list