Pass returncode to Error exception when creating instance
This commit is contained in:
parent
a0666354dd
commit
46d6a3fc27
|
@ -49,8 +49,9 @@ class Failed(OutcomeException):
|
||||||
class Exit(KeyboardInterrupt):
|
class Exit(KeyboardInterrupt):
|
||||||
""" raised for immediate program exits (no tracebacks/summaries)"""
|
""" raised for immediate program exits (no tracebacks/summaries)"""
|
||||||
|
|
||||||
def __init__(self, msg="unknown reason"):
|
def __init__(self, returncode=None, msg="unknown reason"):
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
|
self.returncode = returncode
|
||||||
KeyboardInterrupt.__init__(self, msg)
|
KeyboardInterrupt.__init__(self, msg)
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,10 +61,7 @@ class Exit(KeyboardInterrupt):
|
||||||
def exit(msg, returncode=None):
|
def exit(msg, returncode=None):
|
||||||
""" exit testing process as if KeyboardInterrupt was triggered. """
|
""" exit testing process as if KeyboardInterrupt was triggered. """
|
||||||
__tracebackhide__ = True
|
__tracebackhide__ = True
|
||||||
if returncode:
|
raise Exit(returncode, msg)
|
||||||
raise SystemExit(returncode)
|
|
||||||
else:
|
|
||||||
raise Exit(msg)
|
|
||||||
|
|
||||||
|
|
||||||
exit.Exception = Exit
|
exit.Exception = Exit
|
||||||
|
|
Loading…
Reference in New Issue