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

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


http://hg.python.org/cpython/rev/b56341a49eab
changeset:   90142:b56341a49eab
branch:      2.7
parent:      90133:6809b434752a
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