]> granicus.if.org Git - python/commitdiff
Issue #15817: Bugfix: remove temporary directories test_shutil was leaving
authorLarry Hastings <larry@hastings.org>
Tue, 26 Jun 2012 06:50:01 +0000 (23:50 -0700)
committerLarry Hastings <larry@hastings.org>
Tue, 26 Jun 2012 06:50:01 +0000 (23:50 -0700)
behind.

Lib/test/test_shutil.py
Misc/NEWS

index d23deee62496ab29e520958e4854bda00d981a59..49be391ec53653113d3e35472d9a97113b5e6d71 100644 (file)
@@ -1174,6 +1174,7 @@ class TestShutil(unittest.TestCase):
         # 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 @@ class TestWhich(unittest.TestCase):
 
     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 @@ class TestCopyFile(unittest.TestCase):
         # 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())
index 724540b45402473841f5fa929c57a13a3d39be50..82b3b72ad293f7d9d65434e8aea8707ffaf405d0 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -58,6 +58,9 @@ Core and Builtins
 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