summaryrefslogtreecommitdiff
path: root/Lib/packaging/tests/support.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-06-17 13:25:53 +0200
committerVictor Stinner <victor.stinner@haypocalc.com>2011-06-17 13:25:53 +0200
commit0f270b2c37efd2c9600d9f8648918d9b3479dd94 (patch)
treed5efb0df1a52ce82e42b28407e19785aee3fff30 /Lib/packaging/tests/support.py
parent3bcc0170bdd5dca6b87c12c7894454e352b53492 (diff)
downloadcpython-git-0f270b2c37efd2c9600d9f8648918d9b3479dd94.tar.gz
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.
Diffstat (limited to 'Lib/packaging/tests/support.py')
-rw-r--r--Lib/packaging/tests/support.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/packaging/tests/support.py b/Lib/packaging/tests/support.py
index 47ce513d18..8394f54607 100644
--- a/Lib/packaging/tests/support.py
+++ b/Lib/packaging/tests/support.py
@@ -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):