[svn r57558] should have come with 57557 - extend "acceptance" test machinery.
--HG-- branch : trunk
This commit is contained in:
parent
3652fbfe85
commit
89cdf3b8a4
|
@ -15,14 +15,12 @@ class Result:
|
||||||
self.errlines = errlines
|
self.errlines = errlines
|
||||||
|
|
||||||
class AcceptBase(FileCreation):
|
class AcceptBase(FileCreation):
|
||||||
def popen(self, cmdargs, stdout, stderr):
|
def popen(self, cmdargs, stdout, stderr, **kw):
|
||||||
if not hasattr(py.std, 'subprocess'):
|
if not hasattr(py.std, 'subprocess'):
|
||||||
py.test.skip("no subprocess module")
|
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):
|
def run(self, *cmdargs):
|
||||||
pytestcmd = py.path.local(py.__file__).dirpath("bin", "py.test")
|
|
||||||
cmdargs = [py.std.sys.executable, pytestcmd] + list(args)
|
|
||||||
cmdargs = map(str, cmdargs)
|
cmdargs = map(str, cmdargs)
|
||||||
p1 = py.path.local("stdout")
|
p1 = py.path.local("stdout")
|
||||||
p2 = py.path.local("stderr")
|
p2 = py.path.local("stderr")
|
||||||
|
@ -35,6 +33,18 @@ class AcceptBase(FileCreation):
|
||||||
print >>py.std.sys.stderr, line
|
print >>py.std.sys.stderr, line
|
||||||
return Result(ret, out, err)
|
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):
|
def setup_method(self, method):
|
||||||
super(AcceptBase, self).setup_method(method)
|
super(AcceptBase, self).setup_method(method)
|
||||||
self.old = self.tmpdir.chdir()
|
self.old = self.tmpdir.chdir()
|
||||||
|
|
Loading…
Reference in New Issue