summaryrefslogtreecommitdiff
path: root/testing/test_tmpdir.py
diff options
context:
space:
mode:
authorholger krekel <holger@merlinux.eu>2010-11-13 11:30:40 +0100
committerholger krekel <holger@merlinux.eu>2010-11-13 11:30:40 +0100
commit076e03e90f45a1424bd1ac35c2b80c3609486b23 (patch)
tree878d74c32215dc5ebf3fce2686bebb5a79f92238 /testing/test_tmpdir.py
parent929291775e38b32da89767e7016aa5736fa0ec69 (diff)
downloadpytest-076e03e90f45a1424bd1ac35c2b80c3609486b23.tar.gz
also un-nest test directory
Diffstat (limited to 'testing/test_tmpdir.py')
-rw-r--r--testing/test_tmpdir.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/testing/test_tmpdir.py b/testing/test_tmpdir.py
new file mode 100644
index 000000000..66ba5d1aa
--- /dev/null
+++ b/testing/test_tmpdir.py
@@ -0,0 +1,29 @@
+import py
+
+from _pytest.tmpdir import pytest_funcarg__tmpdir
+from _pytest.python import FuncargRequest
+
+def test_funcarg(testdir):
+ item = testdir.getitem("""
+ def pytest_generate_tests(metafunc):
+ metafunc.addcall(id='a')
+ metafunc.addcall(id='b')
+ def test_func(tmpdir): pass
+ """, 'test_func[a]')
+ p = pytest_funcarg__tmpdir(FuncargRequest(item))
+ assert p.check()
+ bn = p.basename.strip("0123456789")
+ 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')
+ d1 = py.test.ensuretemp('hello')
+ d2 = py.test.ensuretemp('hello')
+ assert d1 == d2
+ assert d1.check(dir=1)
+