[Python-checkins] distutils2: added some cleanup after the tests to make sure that we don't leak temp files

tarek.ziade python-checkins at python.org
Sun Jan 30 10:45:09 CET 2011


tarek.ziade pushed 18cd862b069f to distutils2:

http://hg.python.org/distutils2/rev/18cd862b069f
changeset:   962:18cd862b069f
user:        Yannick Gingras <ygingras at ygingras.net>
date:        Sat Jan 29 20:37:55 2011 -0500
summary:
  added some cleanup after the tests to make sure that we don't leak temp files

files:
  distutils2/tests/test_install.py

diff --git a/distutils2/tests/test_install.py b/distutils2/tests/test_install.py
--- a/distutils2/tests/test_install.py
+++ b/distutils2/tests/test_install.py
@@ -39,6 +39,11 @@
             for f in range(0,3):
                self._real_files.append(mkstemp())
 
+    def _unlink_installed_files(self):
+        if self._files:
+            for f in self._real_files:
+                os.unlink(f[1])
+
     def get_installed_files(self, **args):
         if self._files:
             return [f[1] for f in self._real_files]
@@ -341,6 +346,7 @@
             for dist in remove:
                 for f in dist.get_installed_files():
                     self.assertTrue(os.path.exists(f))
+                dist._unlink_installed_files()
         finally:
             install.install_dist = old_install_dist
             install.uninstall = old_uninstall

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


More information about the Python-checkins mailing list