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 = []
|
self._files = []
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
os.chdir(self._olddir)
|
|
||||||
shutil.rmtree(self._basetempdir)
|
|
||||||
|
|
||||||
for handle, name in self._files:
|
for handle, name in self._files:
|
||||||
handle.close()
|
handle.close()
|
||||||
unlink(name)
|
unlink(name)
|
||||||
|
|
||||||
|
os.chdir(self._olddir)
|
||||||
|
shutil.rmtree(self._basetempdir)
|
||||||
super(TempdirManager, self).tearDown()
|
super(TempdirManager, self).tearDown()
|
||||||
|
|
||||||
def mktempfile(self):
|
def mktempfile(self):
|
||||||
|
|
Loading…
Reference in New Issue