e3.testsuite.result
Data structures for testcase execution results.
Attributes
Classes
Testcase execution status. |
|
Reason for a test failure. |
|
Object to hold long text or binary logs. |
|
Represent a result for a given test. |
|
Basic data about a test result. |
Functions
|
Return a human readable representation for the given bytes string. |
|
Truncate an output not to exceed twice the given number of lines. |
|
|
|
|
|
|
|
|
|
Module Contents
- class e3.testsuite.result.TestStatus(*args, **kwds)
Bases:
enum.EnumTestcase execution status.
- PASS
- FAIL
- XFAIL
- XPASS
- VERIFY
- SKIP
- NOT_APPLICABLE
- ERROR
- color(colors: e3.testsuite.utils.ColorConfig) str
Return the ANSI color code for this test status.
This returns an empty string if colors are disabled.
- class e3.testsuite.result.FailureReason(*args, **kwds)
Bases:
enum.EnumReason for a test failure.
- CRASH
- TIMEOUT
- MEMCHECK
- DIFF
- class e3.testsuite.result.Log(content: AnyStr)
Bases:
yaml.YAMLObject,Generic[AnyStr]Object to hold long text or binary logs.
We ensure that when dump to yaml the result will be human readable.
- yaml_loader
- yaml_tag = '!e3.testsuite.result.Log'
- log: AnyStr
- property is_binary: bool
Return whether this log contains binary data.
- property is_text: bool
Return whether this log contains text data.
- __iadd__(content: AnyStr) Log[AnyStr]
Add additional content to the log.
- Parameters:
content – a message to log
- __str__() str
- e3.testsuite.result.binary_repr(binary: bytes) str
Return a human readable representation for the given bytes string.
This just decodes ASCII printable bytes and newlines to the corresponding strings and represents other bytes with the “xXX” escapes.
- Parameters:
binary – Bytes string to represent.
- e3.testsuite.result.truncated(output: str, line_count: int) str
Truncate an output not to exceed twice the given number of lines.
If
outputhas more than2 * line_countlines, only keep the firstNand lastNlines of it. Return it unchanged otherwise, or ifline_countis 0.- Parameters:
output – Output to (maybe) truncate.
line_count – Half the maximum number of lines to keep.
- class e3.testsuite.result.TestResult(name: str, env: dict | None = None, status: TestStatus | None = None, msg: str = '')
Bases:
yaml.YAMLObjectRepresent a result for a given test.
- yaml_loader
- yaml_tag = '!e3.testsuite.result.TestResult'
- test_name
- env = None
- status
- msg: str | None = ''
- log
- processes: list = []
- failure_reasons: Set[FailureReason]
- time: float | None = None
- info: Dict[str, str]
- set_status(status: TestStatus, msg: str | None = '') None
Update the test status.
- Parameters:
status – New status. Note that only test results with status set to ERROR can be changed.
msg – Optional short message to describe the result. Note that multiline strings are turned into single-line strings.
- __str__() str
- save(results_dir: str) str
Write this test results as a YAML file.
- Parameters:
results_dir – Name of the directory in which to write the test result. When writing a testsuite report, this corresponds to the report’s
results_dir(seee3.testsuite.report.index.ReportIndex).- Returns:
The base filename of the file written. It is generated from the testname.
- property summary: TestResultSummary
- e3.testsuite.result._test_status_tag = '!e3.testsuite.result.TestStatus'
- e3.testsuite.result._failure_reason_tag = '!e3.testsuite.result.FailureReason'
- e3.testsuite.result._test_status_constructor(self: Any, node: Any) Iterator[Any]
- e3.testsuite.result._test_status_representer(dumper: Any, data: TestStatus) Any
- e3.testsuite.result._failure_reason_constructor(self: Any, node: Any) Iterator[Any]
- e3.testsuite.result._failure_reason_representer(dumper: Any, data: FailureReason) Any
- class e3.testsuite.result.TestResultSummary
Basic data about a test result.
This class holds a subset of the information available in
TestResultinstances. This subset is meant to be small enough to be included in result indexes while enabling efficient common processings such as “show logs for tests that failed”: no need to load all the test results for tests that succeeded.- test_name: str
- status: TestStatus
- msg: str | None
- failure_reasons: Set[FailureReason]
- time: float | None
- info: Dict[str, str]