[Python-checkins] cpython: Issue #12333: close files before removing the directory

victor.stinner python-checkins at python.org
Fri Jun 17 13:54:28 CEST 2011


http://hg.python.org/cpython/rev/6e5a9f16d831
changeset: 70833:6e5a9f16d831
user: Victor Stinner <victor.stinner at haypocalc.com>
date: Fri Jun 17 13:25:53 2011 +0200
summary:
 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.
files:
 Lib/packaging/tests/support.py | 5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/Lib/packaging/tests/support.py b/Lib/packaging/tests/support.py
--- a/Lib/packaging/tests/support.py
+++ b/Lib/packaging/tests/support.py
@@ -126,13 +126,12 @@
 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):
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /