e3.testsuite.report.index
Lightweight index for test results.
Loading all test results for big testsuites can take a lot of time because of all the YAML parsing involved. This module provides helpers to efficiently read and write an index of test results. This index contains only test names, statuses and messages, so it is super fast to read. From there, users can load individual test full results only when needed.
Classes
ReportIndex entry for a single test result. |
|
Lightweight index for test results. |
Module Contents
- class e3.testsuite.report.index.ReportIndexEntry
ReportIndex entry for a single test result.
- index: ReportIndex
- filename: str
- property test_name: str
- property status: e3.testsuite.result.TestStatus
- property msg: str | None
- property failure_reasons: Set[e3.testsuite.result.FailureReason]
- property time: float | None
- property info: Dict[str, str]
- class e3.testsuite.report.index.ReportIndex(results_dir: str)
Lightweight index for test results.
- INDEX_FILENAME = '_index.json'
- INDEX_MAGIC = 'e3.testsuite.report.index.ReportIndex:1'
- results_dir
Directory that contain test results (YAML files).
- entries: Dict[str, ReportIndexEntry]
Map test names to their ReportIndexEntry instances.
- status_counters
Number of test result for each test status.
- duration: float | None = None
Optional number of seconds for the total duration of the testsuite run.
- save_and_add_result(result: e3.testsuite.result.TestResult) None
Save a test result in the results directory and add it to the index.
- Parameters:
result – Test result to save/add.
- add_result(result: e3.testsuite.result.TestResultSummary, filename: str) None
Add an entry to this index for the given test result.
Note that unlike
save_and_add_result, this does not write the result data in the results dir: it is up to the caller to make sure of that.- Parameters:
result – Result to add.
filename – Name of the file that contains test result data.
- classmethod read(results_dir: str) ReportIndex
Read the index in the given results directory.
- write() None
Write the index on disk.
- property has_failures: bool
Return whether there is at least one FAIL/ERROR test status.