Skip to content

Commit

Permalink
tests: Print command that failed
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Finucane <stephen@that.guru>
  • Loading branch information
stephenfin committed Aug 29, 2024
1 parent 2180f19 commit 901bc62
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions stestr/tests/test_return_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,17 @@ def assertRunExit(self, cmd, expected, subunit=False, stdin=None):

if not subunit:
self.assertEqual(
p.returncode, expected, "Stdout: {}; Stderr: {}".format(out, err)
p.returncode,
expected,
"Command: {}; Stdout: {}; Stderr: {}".format(cmd, out, err),
)
return (out, err)
else:
self.assertEqual(
p.returncode,
expected,
"Expected return code: %s doesn't match actual "
"return code of: %s" % (expected, p.returncode),
"Expected return code: {} doesn't match actual "
"return code of: {}. Command: {}".format(expected, p.returncode, cmd),
)
output_stream = io.BytesIO(out)
stream = subunit_lib.ByteStreamToStreamResult(output_stream)
Expand Down

0 comments on commit 901bc62

Please sign in to comment.