slightly refine invocation of py.test: use the py lib that we got invoked with,
does away with the need to not-chdir some tests --HG-- branch : trunk
This commit is contained in:
parent
fd76cd8f41
commit
a20e60aeae
|
@ -69,8 +69,7 @@ class TmpTestdir:
|
||||||
self.tmpdir = tmpdir.mkdir(name)
|
self.tmpdir = tmpdir.mkdir(name)
|
||||||
self.plugins = []
|
self.plugins = []
|
||||||
self._syspathremove = []
|
self._syspathremove = []
|
||||||
if not hasattr(request.function, "nochdir"):
|
self.chdir() # always chdir
|
||||||
self.chdir() # always chdir
|
|
||||||
self.request.addfinalizer(self.finalize)
|
self.request.addfinalizer(self.finalize)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
@ -316,7 +315,9 @@ class TmpTestdir:
|
||||||
else:
|
else:
|
||||||
cmdlinename = scriptname.replace(".", "")
|
cmdlinename = scriptname.replace(".", "")
|
||||||
assert hasattr(py.cmdline, cmdlinename), cmdlinename
|
assert hasattr(py.cmdline, cmdlinename), cmdlinename
|
||||||
source = "import py ; py.cmdline.%s()" % cmdlinename
|
source = ("import sys ; sys.path.insert(0, %r); "
|
||||||
|
"import py ; py.cmdline.%s()" %
|
||||||
|
(str(py._dir.dirpath()), cmdlinename))
|
||||||
return (sys.executable, "-c", source,)
|
return (sys.executable, "-c", source,)
|
||||||
|
|
||||||
def runpython(self, script):
|
def runpython(self, script):
|
||||||
|
|
|
@ -4,8 +4,6 @@ import subprocess
|
||||||
def pytest_funcarg__standalone(request):
|
def pytest_funcarg__standalone(request):
|
||||||
return request.cached_setup(scope="module", setup=lambda: Standalone(request))
|
return request.cached_setup(scope="module", setup=lambda: Standalone(request))
|
||||||
|
|
||||||
pytestmark = py.test.mark.nochdir
|
|
||||||
|
|
||||||
class Standalone:
|
class Standalone:
|
||||||
def __init__(self, request):
|
def __init__(self, request):
|
||||||
self.testdir = request.getfuncargvalue("testdir")
|
self.testdir = request.getfuncargvalue("testdir")
|
||||||
|
|
Loading…
Reference in New Issue