results
- Functions and helpers for result management when working with
TMT uses the standard reporting behavior (result:respect), where the overall test outcome is determined by the exit code. Sub-results are reported as flat entries in tmt-report-results.yaml (the same file that the tmt-report-result script writes to), and TMT converts them into subresults under the main test result. Log files for the main result are submitted via the tmt-file-submit command, which copies them to the TMT data directory and registers them to be included in the main result’s log list. See: https://tmt.readthedocs.io/en/stable/spec/results.html https://tmt.readthedocs.io/en/stable/spec/tests.html#spec-tests-result
Module Contents
- class results.Counter
Bases:
collections.defaultdictdict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s
(key, value) pairs
- dict(iterable) -> new dictionary initialized as if via:
d = {} for k, v in iterable:
d[k] = v
- dict(**kwargs) -> new dictionary initialized with the name=value pairs
in the keyword argument list. For example: dict(one=1, two=2)
- total()
- results.global_counts
- results.have_atex_api()
Return True if we can report results via ATEX Minitmt natively.
- results.have_tmt_api()
Return True if we can report results via TMT natively.
- results.report_atex(status, name=None, note=None, logs=None, *, partial=False)
- results.report_tmt(status, name=None, note=None, logs=None)
- results.report_plain(status, name=None, note=None, logs=None)
- results.report(status, name=None, note=None, logs=None)
Report a test result.
‘name’ will be appended to the currently running test name, allowing the test to report one or more sub-results. If empty, result for the test itself is reported.
‘logs’ is a list of file paths (relative to CWD) to be copied or uploaded, and associated with the new result.
Returns the final ‘status’, potentially modified by the waiving logic.
- results.add_log(*logs)
Add log file(s) to be associated with the main test result.
The log file(s) will be processed immediately: - For ATEX: uploaded incrementally using report_atex() with partial=True - For TMT: submitted via tmt-file-submit so they appear on the main result
This allows logs to be added incrementally throughout the test, and ensures they’re available even if the test later fails with a traceback.
Multiple logs can be added by calling this function multiple times, or by passing multiple arguments.
- results.report_and_exit(status=None, note=None, logs=None)
Report a result for the test itself and exit with 0 or 2, depending on whether there were any failures reported during execution of the test.
Additional logs can be passed via the ‘logs’ parameter.