Issue #12333: close files before removing the directory
packaging.tests.support.TempdirManager: rmtree() fails on Windows if there are still open files in the directory.
This commit is contained in:
parent
3bcc0170bd
commit
0f270b2c37
|
@ -126,13 +126,12 @@ class TempdirManager:
|
|||
self._files = []
|
||||
|
||||
def tearDown(self):
|
||||
os.chdir(self._olddir)
|
||||
shutil.rmtree(self._basetempdir)
|
||||
|
||||
for handle, name in self._files:
|
||||
handle.close()
|
||||
unlink(name)
|
||||
|
||||
os.chdir(self._olddir)
|
||||
shutil.rmtree(self._basetempdir)
|
||||
super(TempdirManager, self).tearDown()
|
||||
|
||||
def mktempfile(self):
|
||||
|
|
Loading…
Reference in New Issue