[pypy-svn] r78233 - pypy/branch/fast-forward/lib-python/modified-2.7.0/test

afa at codespeak.net afa at codespeak.net
Sat Oct 23 16:59:32 CEST 2010


Author: afa
Date: Sat Oct 23 16:59:30 2010
New Revision: 78233

Added:
   pypy/branch/fast-forward/lib-python/modified-2.7.0/test/test_dumbdbm.py
      - copied, changed from r78232, pypy/branch/fast-forward/lib-python/2.7.0/test/test_dumbdbm.py
Log:
Close the file in dumbdbm test


Copied: pypy/branch/fast-forward/lib-python/modified-2.7.0/test/test_dumbdbm.py (from r78232, pypy/branch/fast-forward/lib-python/2.7.0/test/test_dumbdbm.py)
==============================================================================
--- pypy/branch/fast-forward/lib-python/2.7.0/test/test_dumbdbm.py	(original)
+++ pypy/branch/fast-forward/lib-python/modified-2.7.0/test/test_dumbdbm.py	Sat Oct 23 16:59:30 2010
@@ -107,9 +107,11 @@
         f.close()
 
         # Mangle the file by adding \r before each newline
-        data = open(_fname + '.dir').read()
+        with open(_fname + '.dir') as f:
+            data = f.read()
         data = data.replace('\n', '\r\n')
-        open(_fname + '.dir', 'wb').write(data)
+        with open(_fname + '.dir', 'wb') as f:
+            f.write(data)
 
         f = dumbdbm.open(_fname)
         self.assertEqual(f['1'], 'hello')



More information about the Pypy-commit mailing list