fix standalone script generation on windows, make tests not do a chdir() so that distributed testing discovers the transferred lib
--HG-- branch : trunk
This commit is contained in:
parent
47df1e16b6
commit
e0dd171e45
|
@ -40,7 +40,7 @@ def main(pybasedir, outfile, infile):
|
|||
|
||||
name2src = {}
|
||||
for f in files:
|
||||
k = f.replace("/", ".")[:-3]
|
||||
k = f.replace(os.sep, ".")[:-3]
|
||||
name2src[k] = open(f, "rb").read()
|
||||
|
||||
data = pickle.dumps(name2src, 2)
|
||||
|
|
|
@ -69,8 +69,8 @@ class TmpTestdir:
|
|||
self.tmpdir = tmpdir.mkdir(name)
|
||||
self.plugins = []
|
||||
self._syspathremove = []
|
||||
self.chdir() # always chdir
|
||||
assert hasattr(self, '_olddir')
|
||||
if not hasattr(request.function, "nochdir"):
|
||||
self.chdir() # always chdir
|
||||
self.request.addfinalizer(self.finalize)
|
||||
|
||||
def __repr__(self):
|
||||
|
@ -280,12 +280,7 @@ class TmpTestdir:
|
|||
return py.std.subprocess.Popen(cmdargs, stdout=stdout, stderr=stderr, **kw)
|
||||
|
||||
def run(self, *cmdargs):
|
||||
old = self.tmpdir.chdir()
|
||||
#print "chdir", self.tmpdir
|
||||
try:
|
||||
return self._run(*cmdargs)
|
||||
finally:
|
||||
old.chdir()
|
||||
return self._run(*cmdargs)
|
||||
|
||||
def _run(self, *cmdargs):
|
||||
cmdargs = [str(x) for x in cmdargs]
|
||||
|
|
|
@ -4,11 +4,15 @@ import subprocess
|
|||
def pytest_funcarg__standalone(request):
|
||||
return request.cached_setup(scope="module", setup=lambda: Standalone(request))
|
||||
|
||||
pytestmark = py.test.mark.nochdir
|
||||
|
||||
class Standalone:
|
||||
def __init__(self, request):
|
||||
self.testdir = request.getfuncargvalue("testdir")
|
||||
self.script = self.testdir.tmpdir.join("mypytest")
|
||||
self.testdir.runpytest("--genscript=%s" % self.script)
|
||||
result = self.testdir.runpytest("--genscript=%s" % self.script)
|
||||
assert result.ret == 0
|
||||
assert self.script.check()
|
||||
|
||||
def run(self, anypython, testdir, *args):
|
||||
testdir.chdir()
|
||||
|
|
Loading…
Reference in New Issue