make temporary read-only files writable, so rmtree can remove them (#21128)

This commit is contained in:
Benjamin Peterson 2014-04-04 13:55:56 -04:00
parent 18fc4e70f3
commit 511e222e0a

View file

@ -47,6 +47,9 @@ class TempDirMixin(object):
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):