Bug 1754726 - Add capturing for stderr when running Python Tests r=ahal

Since stdout is being piped, redirecting stderr to stdout causes it
to end up in the same pipe interleaved, which is what we want.

Also added a non-zero return code to be set when there is no test output.

Differential Revision: https://phabricator.services.mozilla.com/D138481
This commit is contained in:
ahochheiden 2022-02-11 18:04:18 +00:00
parent e3dadbf6b0
commit ac7433fc00

View File

@ -318,7 +318,12 @@ def _run_python_test(command_context, test, jobs, verbose):
env["PYTHONDONTWRITEBYTECODE"] = "1"
result = subprocess.run(
cmd, env=env, stdout=subprocess.PIPE, universal_newlines=True, encoding="UTF-8"
cmd,
env=env,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True,
encoding="UTF-8",
)
return_code = result.returncode
@ -338,6 +343,7 @@ def _run_python_test(command_context, test, jobs, verbose):
_log(line)
if not file_displayed_test:
return_code = 1
_log(
"TEST-UNEXPECTED-FAIL | No test output (missing mozunit.main() "
"call?): {}".format(test["path"])