parent
dc5e2f5ed3
commit
56afcfc9f3
|
@ -8,7 +8,7 @@ usage example::
|
|||
.. _`py.path.local`: ../../path.html
|
||||
|
||||
"""
|
||||
import pytest
|
||||
import pytest, py
|
||||
|
||||
def pytest_configure(config):
|
||||
def ensuretemp(string, dir=1):
|
||||
|
@ -30,5 +30,6 @@ def pytest_funcarg__tmpdir(request):
|
|||
path object.
|
||||
"""
|
||||
name = request._pyfuncitem.name
|
||||
name = py.std.re.sub("[\W]", "_", name)
|
||||
x = request.config.mktemp(name, numbered=True)
|
||||
return x.realpath()
|
||||
|
|
|
@ -13,7 +13,12 @@ def test_funcarg(testdir):
|
|||
p = pytest_funcarg__tmpdir(FuncargRequest(item))
|
||||
assert p.check()
|
||||
bn = p.basename.strip("0123456789")
|
||||
assert bn.endswith("test_func[a]")
|
||||
assert bn.endswith("test_func_a_")
|
||||
item.name = "qwe/\\abc"
|
||||
p = pytest_funcarg__tmpdir(FuncargRequest(item))
|
||||
assert p.check()
|
||||
bn = p.basename.strip("0123456789")
|
||||
assert bn == "qwe__abc"
|
||||
|
||||
def test_ensuretemp(recwarn):
|
||||
#py.test.deprecated_call(py.test.ensuretemp, 'hello')
|
||||
|
|
Loading…
Reference in New Issue