mirror of
https://github.com/python/cpython.git
synced 2025-12-23 09:19:18 +00:00
make temporary read-only files writable, so rmtree can remove them (#21128)
This commit is contained in:
parent
18fc4e70f3
commit
511e222e0a
1 changed files with 3 additions and 0 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue