[Python-checkins] cpython: Issue #25695: Defer creation of TESTDIRN until the test case is run

martin.panter python-checkins at python.org
Tue Nov 24 17:27:40 EST 2015


https://hg.python.org/cpython/rev/fb72d6d7703c
changeset: 99329:fb72d6d7703c
user: Martin Panter <vadmium+py at gmail.com>
date: Tue Nov 24 22:12:05 2015 +0000
summary:
 Issue #25695: Defer creation of TESTDIRN until the test case is run
files:
 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
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -9,13 +9,11 @@
 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 @@
 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)
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /