[pypy-commit] pypy default: remove read-only files in stdlib tests, also filed issue21128 with cpython

mattip noreply at buildbot.pypy.org
Wed Apr 2 00:27:33 CEST 2014


Author: Matti Picus <matti.picus at gmail.com>
Branch: 
Changeset: r70384:548126e2b490
Date: 2014-04-02 01:24 +0300
http://bitbucket.org/pypy/pypy/changeset/548126e2b490/

Log:	remove read-only files in stdlib tests, also filed issue21128 with
	cpython

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
@@ -10,6 +10,7 @@
 import tempfile
 import unittest
 import argparse
+import gc
 
 from StringIO import StringIO
 
@@ -47,7 +48,11 @@
 
     def tearDown(self):
         os.chdir(self.old_dir)
-        shutil.rmtree(self.temp_dir, True)
+        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)
+        shutil.rmtree(self.temp_dir, True)        
 
     def create_readonly_file(self, filename):
         file_path = os.path.join(self.temp_dir, filename)


More information about the pypy-commit mailing list