From: Tim Peters Date: Mon, 31 Mar 2003 22:48:29 +0000 (+0000) Subject: This was failing on Windows, due to various attempts to delete files X-Git-Tag: v2.2.3c1~87 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=44198f0465506f8a8d54b7a9e1f929e24e695d4e;p=thirdparty%2FPython%2Fcpython.git This was failing on Windows, due to various attempts to delete files that were still open. Made the tail end of the test look more like the CVS head version. --- diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py index 69d3cd5311f5..a6796d5279ad 100644 --- a/Lib/test/test_mmap.py +++ b/Lib/test/test_mmap.py @@ -290,31 +290,26 @@ def test_both(): slice = data[start : finish] vereq(m.find(slice), data.find(slice)) vereq(m.find(slice + 'x'), -1) + m.close() finally: - try: - os.unlink(TESTFN) - except OSError: - pass + os.unlink(TESTFN) # make sure a double close doesn't crash on Solaris (Bug# 665913) f = open(TESTFN, 'w+') try: # unlink TESTFN no matter what - f.write(2**24 * 'a') # Arbitrary character + f.write(2**16 * 'a') # Arbitrary character f.close() f = open(TESTFN) - mf = mmap.mmap(f.fileno(), 2**24, access=mmap.ACCESS_READ) + mf = mmap.mmap(f.fileno(), 2**16, access=mmap.ACCESS_READ) mf.close() mf.close() f.close() finally: - try: - os.unlink(TESTFN) - except OSError: - pass + os.unlink(TESTFN) print ' Test passed'