From 0def6737acc682b5fde3f2645846de9956e2ba41 Mon Sep 17 00:00:00 2001 From: hpk Date: Tue, 17 Mar 2009 14:10:17 +0100 Subject: [PATCH] [svn r62998] tweak another place to not create random subdirs --HG-- branch : trunk --- py/test/plugin/pytest_tmpdir.py | 15 ++------------- py/test/testing/acceptance_test.py | 3 ++- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/py/test/plugin/pytest_tmpdir.py b/py/test/plugin/pytest_tmpdir.py index ad2520517..4477af0a0 100644 --- a/py/test/plugin/pytest_tmpdir.py +++ b/py/test/plugin/pytest_tmpdir.py @@ -13,19 +13,9 @@ class TmpdirPlugin: """ provide temporary directories to test functions and methods. """ - def pytest_configure(self, config): - # XXX make ensuretemp live on config - self.basetmp = py.test.ensuretemp("tmpdir") - def pytest_pyfuncarg_tmpdir(self, pyfuncitem): name = pyfuncitem.name - for i in range(10000): - try: - tmpdir = self.basetmp.mkdir(name + (i and str(i) or '')) - except py.error.EEXIST: - continue - break - return tmpdir + return pyfuncitem._config.mktemp(name, numbered=True) # =============================================================================== # @@ -39,8 +29,7 @@ def test_generic(plugintester): def test_pyfuncarg(testdir): item = testdir.getitem("def test_func(tmpdir): pass") plugin = TmpdirPlugin() - plugin.pytest_configure(item._config) p = plugin.pytest_pyfuncarg_tmpdir(item) assert p.check() - bn = p.basename.strip("0123456789") + bn = p.basename.strip("0123456789-") assert bn.endswith("test_func") diff --git a/py/test/testing/acceptance_test.py b/py/test/testing/acceptance_test.py index d315a27b6..981146b3c 100644 --- a/py/test/testing/acceptance_test.py +++ b/py/test/testing/acceptance_test.py @@ -373,7 +373,9 @@ class TestPyTest: class TestInteractive: def getspawn(self, tmpdir): pexpect = py.test.importorskip("pexpect") + basetemp = tmpdir.mkdir("basetemp") def spawn(cmd): + cmd = cmd + " --basetemp=" + str(basetemp) return pexpect.spawn(cmd, logfile=tmpdir.join("spawn.out").open("w")) return spawn @@ -391,7 +393,6 @@ class TestInteractive: i = 0 assert i == 1 """) - child = spawn("%s %s --pdb %s" % (py.std.sys.executable, pytestpath, p1)) child.timeout = EXPECTTIMEOUT #child.expect(".*def test_1.*")