scenario.testerrors module¶
Test errors.
- exception TestError(message, location=None)¶
Bases:
ExceptionBase 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:
Truefor a real error,Falsefor a simple warning (seeiswarning()) or when the error should be ignored (seeisignored()).
- iswarning()¶
Tells whether this error object is just a warning.
- Returns:
Truefor a simple warning,Falsefor a real error (seeiserror()) or when the error should be ignored (seeisignored()).
- isignored()¶
Tells whether this error object should be ignored.
- Returns:
Truewhen the error should be ignored,Falsefor 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:
TestErrorTest 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
ExceptionErrorinstance from its JSON representation.- Parameters:
json_data – JSON dictionary.
- Returns:
New
ExceptionErrorinstance.