Commit 1a31aadd authored by Stefan Behnel's avatar Stefan Behnel

Make it easier to report errors from srctree tests by adding the last output...

Make it easier to report errors from srctree tests by adding the last output to the reported AssertionError.
parent ddaaa7b8
......@@ -1943,16 +1943,18 @@ class EndToEndTest(unittest.TestCase):
p = subprocess.call(command, env=env)
_out, _err = b'', b''
res = p
cmd.append(command)
out.append(_out)
err.append(_err)
cmd.append(command)
out.append(_out)
err.append(_err)
if res == 0 and b'REFNANNY: ' in _out:
res = -1
if res != 0:
for c, o, e in zip(cmd, out, err):
sys.stderr.write("%s\n%s\n%s\n\n" % (
c, self._try_decode(o), self._try_decode(e)))
self.assertEqual(0, res, "non-zero exit status")
self.assertEqual(0, res, "non-zero exit status, last output was:\n%r\n-- stdout:%s\n-- stderr:%s\n" % (
' '.join(command), self._try_decode(out[-1]), self._try_decode(err[-1])))
self.success = True
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment