mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Unittest - Readability and information improvements with test failures
This commit is contained in:
parent
e070500d26
commit
07cd033cbc
2 changed files with 30 additions and 11 deletions
|
@ -5,13 +5,18 @@ import signal
|
|||
class CommandError(Exception):
|
||||
def __init__(self, cmd, code, out, err, msg=None):
|
||||
if msg is None:
|
||||
msg_suffix = (
|
||||
"\n*** Start STDOUT ***\n{2}\n*** End STDOUT ***\n"
|
||||
"\n*** Start STDERR ***\n{3}\n*** End STDERR ***\n"
|
||||
)
|
||||
if code == signal.SIGABRT:
|
||||
self.msg = ("Command '{0}' was aborted, likely due to not "
|
||||
"finishing in due time. The exit code was "
|
||||
"'{1}':\nStdout: '{2}'\nStderr: '{3}'")
|
||||
"finishing in due time. The exit code was '{1}'.\n"
|
||||
) + msg_suffix
|
||||
else:
|
||||
self.msg = ("Command '{0}' finished with unexpected exit code "
|
||||
"'{1}':\nStdout: '{2}'\nStderr: '{3}'")
|
||||
self.msg = ("Command '{0}' finished with unexpected exit "
|
||||
"code '{1}'.\n"
|
||||
) + msg_suffix
|
||||
else:
|
||||
self.msg = msg
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue