make sure we get an absolute path when writing the genscript file
--HG-- branch : trunk
This commit is contained in:
parent
30b756a1a2
commit
d3c0ff3a1f
|
@ -25,13 +25,15 @@ def pytest_configure(config):
|
||||||
mydir = py.path.local(__file__).dirpath()
|
mydir = py.path.local(__file__).dirpath()
|
||||||
infile = mydir.join("standalonetemplate.py")
|
infile = mydir.join("standalonetemplate.py")
|
||||||
pybasedir = py.path.local(py.__file__).dirpath().dirpath()
|
pybasedir = py.path.local(py.__file__).dirpath().dirpath()
|
||||||
|
genscript = py.path.local(genscript)
|
||||||
main(pybasedir, outfile=genscript, infile=infile)
|
main(pybasedir, outfile=genscript, infile=infile)
|
||||||
raise SystemExit(0)
|
raise SystemExit(0)
|
||||||
|
|
||||||
def main(pybasedir, outfile, infile):
|
def main(pybasedir, outfile, infile):
|
||||||
os.chdir(str(pybasedir))
|
|
||||||
outfile = str(outfile)
|
outfile = str(outfile)
|
||||||
infile = str(infile)
|
infile = str(infile)
|
||||||
|
assert os.path.isabs(outfile)
|
||||||
|
os.chdir(str(pybasedir))
|
||||||
files = []
|
files = []
|
||||||
for dirpath, dirnames, filenames in os.walk("py"):
|
for dirpath, dirnames, filenames in os.walk("py"):
|
||||||
for f in filenames:
|
for f in filenames:
|
||||||
|
|
|
@ -7,9 +7,10 @@ def pytest_funcarg__standalone(request):
|
||||||
class Standalone:
|
class Standalone:
|
||||||
def __init__(self, request):
|
def __init__(self, request):
|
||||||
self.testdir = request.getfuncargvalue("testdir")
|
self.testdir = request.getfuncargvalue("testdir")
|
||||||
self.script = self.testdir.tmpdir.join("mypytest")
|
script = "mypytest"
|
||||||
result = self.testdir.runpytest("--genscript=%s" % self.script)
|
result = self.testdir.runpytest("--genscript=%s" % script)
|
||||||
assert result.ret == 0
|
assert result.ret == 0
|
||||||
|
self.script = self.testdir.tmpdir.join(script)
|
||||||
assert self.script.check()
|
assert self.script.check()
|
||||||
|
|
||||||
def run(self, anypython, testdir, *args):
|
def run(self, anypython, testdir, *args):
|
||||||
|
|
Loading…
Reference in New Issue