Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_pkgutil.py @ 72799:ff72f76dcf43 3.2
Issue #7367: Ensure test directory always gets removed.
| author | Ned Deily <nad@acm.org> |
|---|---|
| date | Fri, 07 Oct 2011 12:01:40 -0700 |
| parents | a1e6633ef3f1 |
| children | 48cb6b67d306 |
line wrap: on
line diff
--- a/Lib/test/test_pkgutil.py Fri Oct 07 16:58:07 2011 +0200 +++ b/Lib/test/test_pkgutil.py Fri Oct 07 12:01:40 2011 -0700 @@ -15,11 +15,11 @@ def setUp(self): self.dirname = tempfile.mkdtemp() + self.addCleanup(shutil.rmtree, self.dirname) sys.path.insert(0, self.dirname) def tearDown(self): del sys.path[0] - shutil.rmtree(self.dirname) def test_getdata_filesys(self): pkg = 'test_getdata_filesys' @@ -91,9 +91,9 @@ # this does not appear to create an unreadable dir on Windows # but the test should not fail anyway os.mkdir(d, 0) + self.addCleanup(os.rmdir, d) for t in pkgutil.walk_packages(path=[self.dirname]): self.fail("unexpected package found") - os.rmdir(d) class PkgutilPEP302Tests(unittest.TestCase):
