From c2abb04aac4af7bd51fd96ea62f262c3488b302e Mon Sep 17 00:00:00 2001 From: Rene Meusel Date: Fri, 24 Mar 2023 08:30:14 +0100 Subject: [PATCH] Let test_cli produce stack traces in case of errors This should be particularly useful if CLI functions are used that are unrelated to the function under test. E.g. `test_cli(hash, ...)` to check the output of a previous CLI invocation. --- src/scripts/test_cli.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/scripts/test_cli.py b/src/scripts/test_cli.py index 72ffb70d36a..772c84fd141 100755 --- a/src/scripts/test_cli.py +++ b/src/scripts/test_cli.py @@ -101,17 +101,17 @@ def test_cli(cmd, cmd_options, expected_output=None, cmd_input=None, expected_st if stderr: if expected_stderr is None: - logging.error("Got output on stderr %s (stdout was %s) for command %s", stderr, stdout, cmdline) + logging.error("Got output on stderr %s (stdout was %s) for command %s", stderr, stdout, cmdline, stack_info=True) else: if stderr != expected_stderr: - logging.error("Got output on stderr %s which did not match expected value %s", stderr, expected_stderr) + logging.error("Got output on stderr %s which did not match expected value %s", stderr, expected_stderr, stack_info=True) else: if expected_stderr is not None: - logging.error('Expected output on stderr but got nothing') + logging.error('Expected output on stderr but got nothing', stack_info=True) if expected_output is not None: if stdout != expected_output: - logging.error("Got unexpected output running cmd %s %s", cmd, cmd_options) + logging.error("Got unexpected output running cmd %s %s", cmd, cmd_options, stack_info=True) logging.info("Output lengths %d vs expected %d", len(stdout), len(expected_output)) logging.info("Got %s", stdout) logging.info("Exp %s", expected_output)