[pypy-commit] pypy default: close files opened by FileType option handling, there must be a better way?

mattip noreply at buildbot.pypy.org
Fri May 30 14:45:56 CEST 2014


Author: mattip <matti.picus at gmail.com>
Branch: 
Changeset: r71785:c57ac1c3539e
Date: 2014-05-30 15:44 +0300
http://bitbucket.org/pypy/pypy/changeset/c57ac1c3539e/

Log:	close files opened by FileType option handling, there must be a
	better way?

diff --git a/lib-python/2.7/test/test_argparse.py b/lib-python/2.7/test/test_argparse.py
--- a/lib-python/2.7/test/test_argparse.py
+++ b/lib-python/2.7/test/test_argparse.py
@@ -48,6 +48,9 @@
 
     def tearDown(self):
         os.chdir(self.old_dir)
+        import gc
+        # Force a collection which should close FileType() options
+        gc.collect()
         for root, dirs, files in os.walk(self.temp_dir, topdown=False):
             for name in files:
                 os.chmod(os.path.join(self.temp_dir, name), stat.S_IWRITE)


More information about the pypy-commit mailing list