tests: test_fileimport: improve reporting on failure
This commit is contained in:
parent
423e19909e
commit
b494d3d1c1
|
@ -19,13 +19,19 @@ def test_fileimport(modfile):
|
||||||
# without needing the pytest namespace being set
|
# without needing the pytest namespace being set
|
||||||
# this is critical for the initialization of xdist
|
# this is critical for the initialization of xdist
|
||||||
|
|
||||||
res = subprocess.call(
|
p = subprocess.Popen(
|
||||||
[
|
[
|
||||||
sys.executable,
|
sys.executable,
|
||||||
"-c",
|
"-c",
|
||||||
"import sys, py; py.path.local(sys.argv[1]).pyimport()",
|
"import sys, py; py.path.local(sys.argv[1]).pyimport()",
|
||||||
modfile.strpath,
|
modfile.strpath,
|
||||||
]
|
],
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE,
|
||||||
|
)
|
||||||
|
(out, err) = p.communicate()
|
||||||
|
if p.returncode != 0:
|
||||||
|
pytest.fail(
|
||||||
|
"importing %s failed (exitcode %d): out=%r, err=%r"
|
||||||
|
% (modfile, p.returncode, out, err)
|
||||||
)
|
)
|
||||||
if res:
|
|
||||||
pytest.fail("command result %s" % res)
|
|
||||||
|
|
Loading…
Reference in New Issue