Skip to content

Commit

Permalink
Merge pull request #878 from p12tic/tests-decoded-output
Browse files Browse the repository at this point in the history
tests: Print decoded subprocess output in case of failure
  • Loading branch information
p12tic authored Mar 8, 2024
2 parents a494f20 + 0614687 commit c84b4c3
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 c84b4c3

Please sign in to comment.