Unittest - CommandError exception treats SIGABRT specially
* SIGABRT will be used to signal processes that failed to finish after the process assigned time (default 1 second).
This commit is contained in:
@@ -1,9 +1,15 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
import signal
|
||||||
|
|
||||||
|
|
||||||
class CommandError(Exception):
|
class CommandError(Exception):
|
||||||
def __init__(self, cmd, code, out, err, msg=None):
|
def __init__(self, cmd, code, out, err, msg=None):
|
||||||
if msg is None:
|
if msg is None:
|
||||||
|
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}'")
|
||||||
|
else:
|
||||||
self.msg = ("Command '{0}' finished with unexpected exit code "
|
self.msg = ("Command '{0}' finished with unexpected exit code "
|
||||||
"'{1}':\nStdout: '{2}'\nStderr: '{3}'")
|
"'{1}':\nStdout: '{2}'\nStderr: '{3}'")
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user