[Python-checkins] cpython: Issue #15817: Bugfix: remove temporary directories test_shutil was leaving

larry.hastings python-checkins at python.org
Tue Jun 26 08:50:11 CEST 2012


http://hg.python.org/cpython/rev/1fa50bbcc21f
changeset:   77790:1fa50bbcc21f
user:        Larry Hastings <larry at hastings.org>
date:        Mon Jun 25 23:50:01 2012 -0700
summary:
  Issue #15817: Bugfix: remove temporary directories test_shutil was leaving
behind.

files:
  Lib/test/test_shutil.py |  3 +++
  Misc/NEWS               |  3 +++
  2 files changed, 6 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -1174,6 +1174,7 @@
         # copytree returns its destination path.
         src_dir = self.mkdtemp()
         dst_dir = src_dir + "dest"
+        self.addCleanup(shutil.rmtree, dst_dir, True)
         src = os.path.join(src_dir, 'foo')
         write_file(src, 'foo')
         rv = shutil.copytree(src_dir, dst_dir)
@@ -1184,6 +1185,7 @@
 
     def setUp(self):
         self.temp_dir = tempfile.mkdtemp()
+        self.addCleanup(shutil.rmtree, self.temp_dir, True)
         # Give the temp_file an ".exe" suffix for all.
         # It's needed on Windows and not harmful on other platforms.
         self.temp_file = tempfile.NamedTemporaryFile(dir=self.temp_dir,
@@ -1506,6 +1508,7 @@
         # but a different case.
 
         self.src_dir = tempfile.mkdtemp()
+        self.addCleanup(shutil.rmtree, self.src_dir, True)
         dst_dir = os.path.join(
                 os.path.dirname(self.src_dir),
                 os.path.basename(self.src_dir).upper())
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -58,6 +58,9 @@
 Library
 -------
 
+- Issue #15817: Bugfix: remove temporary directories test_shutil was leaving
+  behind.
+
 - Issue #15177: Added dir_fd parameter to os.fwalk().
 
 - Issue #15176: Clarified behavior, documentation, and implementation

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list