summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pkgutil.py
diff options
context:
space:
mode:
authorNed Deily <nad@acm.org>2011-10-07 19:01:40 (GMT)
committerNed Deily <nad@acm.org>2011-10-07 19:01:40 (GMT)
commit7010a07bd0dab29e5e360f2bbd862ed23ba3f288 (patch)
treed3b6803c0451fe48c5eab9af5fc58e2708d652f1 /Lib/test/test_pkgutil.py
parentf394e4785159167fe8889dd2537c8a74e01d4cc5 (diff)
downloadcpython-7010a07bd0dab29e5e360f2bbd862ed23ba3f288.zip
cpython-7010a07bd0dab29e5e360f2bbd862ed23ba3f288.tar.gz
cpython-7010a07bd0dab29e5e360f2bbd862ed23ba3f288.tar.bz2
Issue #7367: Ensure test directory always gets removed.
Diffstat (limited to 'Lib/test/test_pkgutil.py')
-rw-r--r--Lib/test/test_pkgutil.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/test_pkgutil.py b/Lib/test/test_pkgutil.py
index f755e67..f4e0323 100644
--- a/Lib/test/test_pkgutil.py
+++ b/Lib/test/test_pkgutil.py
@@ -15,11 +15,11 @@ class PkgutilTests(unittest.TestCase):
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 @@ class PkgutilTests(unittest.TestCase):
# 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):