def run_tests(pkgpath, apigenpath, args='', captureouterr=False): |
""" run the unit tests and build the docs """ |
pypath = py.__pkg__.getpath() |
pytestpath = pypath.join('bin/py.test') |
|
|
|
apigenscript = pkgpath.join('apigen/apigen.py') |
if not apigenscript.check(file=True): |
apigenscript = pypath.join('apigen/apigen.py') |
cmd = ('APIGENPATH="%s" PYTHONPATH="%s:%s" python ' |
'"%s" %s --apigen="%s" "%s"' % (apigenpath, pypath.dirpath(), |
pkgpath.dirpath(), pytestpath, |
args, apigenscript, |
pkgpath)) |
if captureouterr: |
cmd += ' > /dev/null 2>&1' |
try: |
-> output = py.process.cmdexec(cmd) |
except py.error.Error, e: |
return e.err or str(e) |
return None |