[svn r57558] should have come with 57557 - extend "acceptance" test machinery.

--HG--
branch : trunk
This commit is contained in:
hpk 2008-08-21 16:26:27 +02:00
parent 3652fbfe85
commit 89cdf3b8a4
1 changed files with 15 additions and 5 deletions

View File

@ -15,14 +15,12 @@ class Result:
self.errlines = errlines
class AcceptBase(FileCreation):
def popen(self, cmdargs, stdout, stderr):
def popen(self, cmdargs, stdout, stderr, **kw):
if not hasattr(py.std, 'subprocess'):
py.test.skip("no subprocess module")
return py.std.subprocess.Popen(cmdargs, stdout=stdout, stderr=stderr)
return py.std.subprocess.Popen(cmdargs, stdout=stdout, stderr=stderr, **kw)
def runpytest(self, *args):
pytestcmd = py.path.local(py.__file__).dirpath("bin", "py.test")
cmdargs = [py.std.sys.executable, pytestcmd] + list(args)
def run(self, *cmdargs):
cmdargs = map(str, cmdargs)
p1 = py.path.local("stdout")
p2 = py.path.local("stderr")
@ -35,6 +33,18 @@ class AcceptBase(FileCreation):
print >>py.std.sys.stderr, line
return Result(ret, out, err)
def runpybin(self, scriptname, *args):
bindir = py.path.local(py.__file__).dirpath("bin")
if py.std.sys.platform == "win32":
script = bindir.join("win32", scriptname + ".cmd")
else:
script = bindir.join(scriptname)
assert script.check()
return self.run(script, *args)
def runpytest(self, *args):
return self.runpybin("py.test", *args)
def setup_method(self, method):
super(AcceptBase, self).setup_method(method)
self.old = self.tmpdir.chdir()