From d3c0ff3a1f75b7759cca73bc7c56318d94a24052 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Mon, 18 Jan 2010 16:48:20 +0100 Subject: [PATCH] make sure we get an absolute path when writing the genscript file --HG-- branch : trunk --- py/_plugin/pytest_genscript.py | 4 +++- testing/plugin/test_pytest_genscript.py | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/py/_plugin/pytest_genscript.py b/py/_plugin/pytest_genscript.py index bf475f43d..68ff9b08f 100755 --- a/py/_plugin/pytest_genscript.py +++ b/py/_plugin/pytest_genscript.py @@ -25,13 +25,15 @@ def pytest_configure(config): mydir = py.path.local(__file__).dirpath() infile = mydir.join("standalonetemplate.py") pybasedir = py.path.local(py.__file__).dirpath().dirpath() + genscript = py.path.local(genscript) main(pybasedir, outfile=genscript, infile=infile) raise SystemExit(0) def main(pybasedir, outfile, infile): - os.chdir(str(pybasedir)) outfile = str(outfile) infile = str(infile) + assert os.path.isabs(outfile) + os.chdir(str(pybasedir)) files = [] for dirpath, dirnames, filenames in os.walk("py"): for f in filenames: diff --git a/testing/plugin/test_pytest_genscript.py b/testing/plugin/test_pytest_genscript.py index d0fb91af9..c421460fc 100644 --- a/testing/plugin/test_pytest_genscript.py +++ b/testing/plugin/test_pytest_genscript.py @@ -7,9 +7,10 @@ def pytest_funcarg__standalone(request): class Standalone: def __init__(self, request): self.testdir = request.getfuncargvalue("testdir") - self.script = self.testdir.tmpdir.join("mypytest") - result = self.testdir.runpytest("--genscript=%s" % self.script) + script = "mypytest" + result = self.testdir.runpytest("--genscript=%s" % script) assert result.ret == 0 + self.script = self.testdir.tmpdir.join(script) assert self.script.check() def run(self, anypython, testdir, *args):