[svn r62998] tweak another place to not create random subdirs
--HG-- branch : trunk
This commit is contained in:
parent
fc7abf0efe
commit
0def6737ac
|
@ -13,19 +13,9 @@ class TmpdirPlugin:
|
||||||
""" provide temporary directories to test functions and methods.
|
""" 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):
|
def pytest_pyfuncarg_tmpdir(self, pyfuncitem):
|
||||||
name = pyfuncitem.name
|
name = pyfuncitem.name
|
||||||
for i in range(10000):
|
return pyfuncitem._config.mktemp(name, numbered=True)
|
||||||
try:
|
|
||||||
tmpdir = self.basetmp.mkdir(name + (i and str(i) or ''))
|
|
||||||
except py.error.EEXIST:
|
|
||||||
continue
|
|
||||||
break
|
|
||||||
return tmpdir
|
|
||||||
|
|
||||||
# ===============================================================================
|
# ===============================================================================
|
||||||
#
|
#
|
||||||
|
@ -39,8 +29,7 @@ def test_generic(plugintester):
|
||||||
def test_pyfuncarg(testdir):
|
def test_pyfuncarg(testdir):
|
||||||
item = testdir.getitem("def test_func(tmpdir): pass")
|
item = testdir.getitem("def test_func(tmpdir): pass")
|
||||||
plugin = TmpdirPlugin()
|
plugin = TmpdirPlugin()
|
||||||
plugin.pytest_configure(item._config)
|
|
||||||
p = plugin.pytest_pyfuncarg_tmpdir(item)
|
p = plugin.pytest_pyfuncarg_tmpdir(item)
|
||||||
assert p.check()
|
assert p.check()
|
||||||
bn = p.basename.strip("0123456789")
|
bn = p.basename.strip("0123456789-")
|
||||||
assert bn.endswith("test_func")
|
assert bn.endswith("test_func")
|
||||||
|
|
|
@ -373,7 +373,9 @@ class TestPyTest:
|
||||||
class TestInteractive:
|
class TestInteractive:
|
||||||
def getspawn(self, tmpdir):
|
def getspawn(self, tmpdir):
|
||||||
pexpect = py.test.importorskip("pexpect")
|
pexpect = py.test.importorskip("pexpect")
|
||||||
|
basetemp = tmpdir.mkdir("basetemp")
|
||||||
def spawn(cmd):
|
def spawn(cmd):
|
||||||
|
cmd = cmd + " --basetemp=" + str(basetemp)
|
||||||
return pexpect.spawn(cmd, logfile=tmpdir.join("spawn.out").open("w"))
|
return pexpect.spawn(cmd, logfile=tmpdir.join("spawn.out").open("w"))
|
||||||
return spawn
|
return spawn
|
||||||
|
|
||||||
|
@ -391,7 +393,6 @@ class TestInteractive:
|
||||||
i = 0
|
i = 0
|
||||||
assert i == 1
|
assert i == 1
|
||||||
""")
|
""")
|
||||||
|
|
||||||
child = spawn("%s %s --pdb %s" % (py.std.sys.executable, pytestpath, p1))
|
child = spawn("%s %s --pdb %s" % (py.std.sys.executable, pytestpath, p1))
|
||||||
child.timeout = EXPECTTIMEOUT
|
child.timeout = EXPECTTIMEOUT
|
||||||
#child.expect(".*def test_1.*")
|
#child.expect(".*def test_1.*")
|
||||||
|
|
Loading…
Reference in New Issue