scenario.testerrors module¶
Test errors.
- exception TestError(message, location=None)¶
Bases:
Exception
Base test error object.
Stores information about an error that occurred during the test.
Declared as an exception so that it can be propagated as is.
- __init__(message, location=None)¶
- Parameters:
message – Error message.
location – Error location.
- message¶
Error message.
- location¶
Error location.
- __str__()¶
Short representation of the error.
- __repr__()¶
Programmatic representation of the error.
- iserror()¶
Tells whether this error object is actually an error.
- Returns:
True
for a real error,False
for a simple warning (seeiswarning()
) or when the error should be ignored (seeisignored()
).
- iswarning()¶
Tells whether this error object is just a warning.
- Returns:
True
for a simple warning,False
for a real error (seeiserror()
) or when the error should be ignored (seeisignored()
).
- isignored()¶
Tells whether this error object should be ignored.
- Returns:
True
when the error should be ignored,False
for a real error (seeiserror()
) or a warning (seeiswarning()
).
- logerror(logger, level=40, indent='')¶
Logs the error info.
- Parameters:
logger – Logger to use for logging.
level – Log level.
indent – Indentation to use.
- exception ExceptionError(exception=None)¶
Bases:
TestError
Test error related to an exception.
- __init__(exception=None)¶
- Parameters:
exception – Root cause exception, if available.
- exception¶
The root cause exception, if any.
- exception_type¶
Type of the exception, if any.
- __str__()¶
Short representation of the exception error.
Exception type + message.
- logerror(logger, level=40, indent='')¶
TestError.logerror()
override in order to log the exception traceback, if an exception is stored.Defaults to
TestError.logerror()
if no exception.
- static fromjson(json_data)¶
Builds a
ExceptionError
instance from its JSON representation.- Parameters:
json_data – JSON dictionary.
- Returns:
New
ExceptionError
instance.