[Python-checkins] cpython (3.4): make temporary read-only files writable, so rmtree can remove them (#21128)

benjamin.peterson python-checkins at python.org
Fri Apr 4 20:00:10 CEST 2014


http://hg.python.org/cpython/rev/9fd33a504b58
changeset:   90145:9fd33a504b58
branch:      3.4
parent:      90134:fef890bd60b1
user:        Benjamin Peterson <benjamin at python.org>
date:        Fri Apr 04 13:55:56 2014 -0400
summary:
  make temporary read-only files writable, so rmtree can remove them (#21128)

files:
  Lib/test/test_argparse.py |  3 +++
  1 files changed, 3 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py
--- a/Lib/test/test_argparse.py
+++ b/Lib/test/test_argparse.py
@@ -47,6 +47,9 @@
 
     def tearDown(self):
         os.chdir(self.old_dir)
+        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):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list