diff options
author | Martin Panter <vadmium+py@gmail.com> | 2015-11-24 22:12:05 (GMT) |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2015-11-24 22:12:05 (GMT) |
commit | 33623b145df4d41f49ab3ae9e781135fb87fd98d (patch) | |
tree | b36a0fd14c9156eee305c4ed1cd8084163515e02 /Lib/test/test_support.py | |
parent | c880ef8d3005aab22c90af43ef1cc34acf4f3719 (diff) | |
download | cpython-33623b145df4d41f49ab3ae9e781135fb87fd98d.zip cpython-33623b145df4d41f49ab3ae9e781135fb87fd98d.tar.gz cpython-33623b145df4d41f49ab3ae9e781135fb87fd98d.tar.bz2 |
Issue #25695: Defer creation of TESTDIRN until the test case is run
Diffstat (limited to 'Lib/test/test_support.py')
-rw-r--r-- | Lib/test/test_support.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index a9ba460..f86ea91 100644 --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -9,13 +9,11 @@ import errno from test import support TESTFN = support.TESTFN -TESTDIRN = os.path.basename(tempfile.mkdtemp(dir='.')) class TestSupport(unittest.TestCase): def setUp(self): support.unlink(TESTFN) - support.rmtree(TESTDIRN) tearDown = setUp def test_import_module(self): @@ -48,6 +46,10 @@ class TestSupport(unittest.TestCase): support.unlink(TESTFN) def test_rmtree(self): + TESTDIRN = os.path.basename(tempfile.mkdtemp(dir='.')) + self.addCleanup(support.rmtree, TESTDIRN) + support.rmtree(TESTDIRN) + os.mkdir(TESTDIRN) os.mkdir(os.path.join(TESTDIRN, TESTDIRN)) support.rmtree(TESTDIRN) |