[py-svn] py-trunk commit 9b9583e84cfb: some adjustments to make py.test --basetemp=XYZ work where
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Mon Jun 7 20:57:57 CEST 2010
# HG changeset patch -- Bitbucket.org
# Project py-trunk
# URL http://bitbucket.org/hpk42/py-trunk/overview
# User holger krekel <holger at merlinux.eu>
# Date 1275937346 -7200
# Node ID 9b9583e84cfba77e3f48b86e1b69d89ab332d2fe
# Parent 9fa2fbdcde2d52974731617c87da2f12f7923ae0
some adjustments to make py.test --basetemp=XYZ work where
XYZ is a subdir the checkout which contains a conftest.py
--- a/py/_plugin/pytest_pytester.py
+++ b/py/_plugin/pytest_pytester.py
@@ -347,6 +347,11 @@ class TmpTestdir:
p = py.path.local.make_numbered_dir(prefix="runpytest-",
keep=None, rootdir=self.tmpdir)
args = ('--basetemp=%s' % p, ) + args
+ for x in args:
+ if '--confcutdir' in str(x):
+ break
+ else:
+ args = ('--confcutdir=.',) + args
plugins = [x for x in self.plugins if isinstance(x, str)]
if plugins:
args = ('-p', plugins[0]) + args
--- a/testing/test_conftesthandle.py
+++ b/testing/test_conftesthandle.py
@@ -31,7 +31,8 @@ class TestConftestValueAccessGlobal:
def test_onimport(self, basedir):
l = []
conftest = Conftest(onimport=l.append)
- conftest.setinitial([basedir.join("adir")])
+ conftest.setinitial([basedir.join("adir"),
+ '--confcutdir=%s' % basedir])
assert len(l) == 2
assert conftest.rget("a") == 1
assert conftest.rget("b", basedir.join("adir", "b")) == 2
@@ -145,7 +146,7 @@ def test_setinitial_conftest_subdirs(tes
sub = testdir.mkdir(name)
subconftest = sub.ensure("conftest.py")
conftest = Conftest()
- conftest.setinitial([sub.dirpath()])
+ conftest.setinitial([sub.dirpath(), '--confcutdir=%s' % testdir.tmpdir])
if name != ".dotdir":
assert subconftest in conftest._conftestpath2mod
assert len(conftest._conftestpath2mod) == 1
More information about the pytest-commit
mailing list