[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.
|
||||
"""
|
||||
|
||||
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")
|
||||
|
|
|
@ -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.*")
|
||||
|
|
Loading…
Reference in New Issue