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

afa at codespeak.net afa at codespeak.net
Mon Nov 8 17:40:18 CET 2010


Author: afa
Date: Mon Nov  8 17:40:17 2010
New Revision: 78880

Added:
   pypy/branch/fast-forward/lib-python/modified-2.7.0/test/test_traceback.py
      - copied, changed from r78879, pypy/branch/fast-forward/lib-python/2.7.0/test/test_traceback.py
Log:
Use a "with" to close the file when done.


Copied: pypy/branch/fast-forward/lib-python/modified-2.7.0/test/test_traceback.py (from r78879, pypy/branch/fast-forward/lib-python/2.7.0/test/test_traceback.py)
==============================================================================
--- pypy/branch/fast-forward/lib-python/2.7.0/test/test_traceback.py	(original)
+++ pypy/branch/fast-forward/lib-python/modified-2.7.0/test/test_traceback.py	Mon Nov  8 17:40:17 2010
@@ -74,7 +74,8 @@
         try:
             sys.path.insert(0, testdir)
             testfile = os.path.join(testdir, 'test_bug737473.py')
-            print >> open(testfile, 'w'), """
+            with open(testfile, 'w') as f:
+                print >> f, """
 def test():
     raise ValueError"""
 
@@ -96,7 +97,8 @@
             # three seconds are needed for this test to pass reliably :-(
             time.sleep(4)
 
-            print >> open(testfile, 'w'), """
+            with open(testfile, 'w') as f:
+                print >> f, """
 def test():
     raise NotImplementedError"""
             reload(test_bug737473)



More information about the Pypy-commit mailing list