[svn r38396] Capturing stdout and stderr when running the update_website tests to not mess
up --rest output. --HG-- branch : trunk
This commit is contained in:
parent
d3cd1c5bcf
commit
275673ba21
|
@ -22,7 +22,7 @@ def rsync(pkgpath, apidocspath, gateway, remotepath):
|
||||||
rs.add_target(gateway, remotepath, delete=True)
|
rs.add_target(gateway, remotepath, delete=True)
|
||||||
rs.send()
|
rs.send()
|
||||||
|
|
||||||
def run_tests(pkgpath, args=''):
|
def run_tests(pkgpath, args='', captureouterr=False):
|
||||||
""" run the unit tests and build the docs """
|
""" run the unit tests and build the docs """
|
||||||
pypath = py.__package__.getpath()
|
pypath = py.__package__.getpath()
|
||||||
pytestpath = pypath.join('bin/py.test')
|
pytestpath = pypath.join('bin/py.test')
|
||||||
|
@ -32,13 +32,16 @@ def run_tests(pkgpath, args=''):
|
||||||
apigenpath = pkgpath.join('apigen/apigen.py') # XXX be more general here?
|
apigenpath = pkgpath.join('apigen/apigen.py') # XXX be more general here?
|
||||||
if not apigenpath.check(file=True):
|
if not apigenpath.check(file=True):
|
||||||
apigenpath = pypath.join('apigen/apigen.py')
|
apigenpath = pypath.join('apigen/apigen.py')
|
||||||
cmd = 'PYTHONPATH="%s:%s" python "%s" --apigen="%s" "%s" %s' % (
|
cmd = 'PYTHONPATH="%s:%s" python "%s" %s --apigen="%s" "%s"' % (
|
||||||
pypath.dirpath(),
|
pypath.dirpath(),
|
||||||
pkgpath.dirpath(),
|
pkgpath.dirpath(),
|
||||||
pytestpath,
|
pytestpath,
|
||||||
|
args,
|
||||||
apigenpath,
|
apigenpath,
|
||||||
pkgpath,
|
pkgpath,
|
||||||
args)
|
)
|
||||||
|
if captureouterr:
|
||||||
|
cmd += ' > /dev/null 2>&1'
|
||||||
status = py.std.os.system(cmd)
|
status = py.std.os.system(cmd)
|
||||||
return status
|
return status
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ def test_run_tests():
|
||||||
if py.std.sys.platform == "win32":
|
if py.std.sys.platform == "win32":
|
||||||
py.test.skip("update_website is not supposed to be run from win32")
|
py.test.skip("update_website is not supposed to be run from win32")
|
||||||
pkgpath = setup_pkg('update_website_run_tests')
|
pkgpath = setup_pkg('update_website_run_tests')
|
||||||
errors = update_website.run_tests(pkgpath)
|
errors = update_website.run_tests(pkgpath, captureouterr=True)
|
||||||
assert not errors
|
assert not errors
|
||||||
assert pkgpath.join('../apigen').check(dir=True)
|
assert pkgpath.join('../apigen').check(dir=True)
|
||||||
assert pkgpath.join('../apigen/api/sub.foo.html').check(file=True)
|
assert pkgpath.join('../apigen/api/sub.foo.html').check(file=True)
|
||||||
|
@ -63,6 +63,6 @@ def test_run_tests_failure():
|
||||||
pkgpath = setup_pkg('update_website_run_tests_failure')
|
pkgpath = setup_pkg('update_website_run_tests_failure')
|
||||||
assert not pkgpath.join('../apigen').check(dir=True)
|
assert not pkgpath.join('../apigen').check(dir=True)
|
||||||
pkgpath.ensure('../apigen', file=True)
|
pkgpath.ensure('../apigen', file=True)
|
||||||
errors = update_website.run_tests(pkgpath, '> /dev/null 2>&1')
|
errors = update_website.run_tests(pkgpath, captureouterr=True)
|
||||||
assert errors # some error message
|
assert errors # some error message
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue