mirror of https://github.com/python/cpython
Issue #25695: Defer creation of TESTDIRN until the test case is run
This commit is contained in:
parent
c880ef8d30
commit
33623b145d
|
@ -9,13 +9,11 @@ import errno
|
||||||
from test import support
|
from test import support
|
||||||
|
|
||||||
TESTFN = support.TESTFN
|
TESTFN = support.TESTFN
|
||||||
TESTDIRN = os.path.basename(tempfile.mkdtemp(dir='.'))
|
|
||||||
|
|
||||||
|
|
||||||
class TestSupport(unittest.TestCase):
|
class TestSupport(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
support.unlink(TESTFN)
|
support.unlink(TESTFN)
|
||||||
support.rmtree(TESTDIRN)
|
|
||||||
tearDown = setUp
|
tearDown = setUp
|
||||||
|
|
||||||
def test_import_module(self):
|
def test_import_module(self):
|
||||||
|
@ -48,6 +46,10 @@ class TestSupport(unittest.TestCase):
|
||||||
support.unlink(TESTFN)
|
support.unlink(TESTFN)
|
||||||
|
|
||||||
def test_rmtree(self):
|
def test_rmtree(self):
|
||||||
|
TESTDIRN = os.path.basename(tempfile.mkdtemp(dir='.'))
|
||||||
|
self.addCleanup(support.rmtree, TESTDIRN)
|
||||||
|
support.rmtree(TESTDIRN)
|
||||||
|
|
||||||
os.mkdir(TESTDIRN)
|
os.mkdir(TESTDIRN)
|
||||||
os.mkdir(os.path.join(TESTDIRN, TESTDIRN))
|
os.mkdir(os.path.join(TESTDIRN, TESTDIRN))
|
||||||
support.rmtree(TESTDIRN)
|
support.rmtree(TESTDIRN)
|
||||||
|
|
Loading…
Reference in New Issue