streamline some tests and overall reduce py.test.ensuretemp usage, note down issue about deprecation .

--HG--
branch : trunk
This commit is contained in:
holger krekel
2009-12-29 22:26:03 +01:00
parent 9be7d78fb1
commit 77b640d1b7
13 changed files with 92 additions and 153 deletions

View File

@@ -32,12 +32,12 @@ class TestGeneralUsage:
mytemp = testdir.tmpdir.mkdir("mytemp")
p = testdir.makepyfile("""
import py
def test_1():
py.test.ensuretemp('xyz')
def test_1(pytestconfig):
pytestconfig.getbasetemp().ensure("hello")
""")
result = testdir.runpytest(p, '--basetemp=%s' %mytemp)
assert result.ret == 0
assert mytemp.join('xyz').check(dir=1)
assert mytemp.join('hello').check()
def test_assertion_magic(self, testdir):
p = testdir.makepyfile("""

View File

@@ -248,8 +248,8 @@ def test_options_on_small_file_do_not_blow_up(testdir):
['--traceconfig'], ['-v'], ['-v', '-v']):
runfiletest(opts + [path])
def test_ensuretemp():
# XXX test for deprecation
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

View File

@@ -8,7 +8,7 @@ def pytest_generate_tests(metafunc):
def pytest_funcarg__basedir(request):
def basedirmaker(request):
basedir = d = request.config.ensuretemp(request.param)
basedir = d = request.getfuncargvalue("tmpdir")
d.ensure("adir/conftest.py").write("a=1 ; Directory = 3")
d.ensure("adir/b/conftest.py").write("b=2 ; a = 1.5")
if request.param == "inpackage":