Skip to content

Commit

Permalink
tests: Print decoded subprocess output in case of failure
Browse files Browse the repository at this point in the history
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
  • Loading branch information
p12tic committed Mar 8, 2024
1 parent a494f20 commit 0614687
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ def run_subprocess(self, args):

def run_subprocess_assert_returncode(self, args, expected_returncode=0):
out, err, returncode = self.run_subprocess(args)
decoded_out = out.decode('utf-8')
decoded_err = err.decode('utf-8')
self.assertEqual(
returncode,
expected_returncode,
f"Invalid return code of process {returncode} != {expected_returncode}\n"
f"stdout: {out}\nstderr: {err}\n",
f"stdout: {decoded_out}\nstderr: {decoded_err}\n",
)
return out, err

0 comments on commit 0614687

Please sign in to comment.