tmt.steps.report package
Submodules
tmt.steps.report.display module
- class tmt.steps.report.display.ReportDisplay(*, step: Step, data: StepDataT, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
ReportPlugin[ReportDisplayData]Show test results on the terminal.
Give a concise summary of test results directly on the terminal. List individual test results in verbose mode.
Store plugin name, data and parent step
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- details(result: Result, verbosity: int, display_guest: bool) None
Print result details.
- Parameters:
result – a test result to display.
verbosity – how verbose should the report be. Generally equal to number of
--verbose/-voptions given on command line. For1, display only test name and its result,2will add log paths, and3or more would show the test output as well.display_guest – if set, guest multihost name would be part of the report.
- class tmt.steps.report.display.ReportDisplayData(name: str, how: str, order: int = 50, summary: str | None = None, display_guest: str = 'auto')
Bases:
ReportStepData- display_guest: str = 'auto'
tmt.steps.report.html module
- class tmt.steps.report.html.ReportHtml(*, step: Step, data: StepDataT, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
ReportPlugin[ReportHtmlData]Format test results into an HTML report.
Example config:
report: how: html open: true
Store plugin name, data and parent step
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- class tmt.steps.report.html.ReportHtmlData(name: str, how: str, order: int = 50, summary: str | None = None, open: bool = False, absolute_paths: bool = False, display_guest: str = 'auto')
Bases:
ReportStepData- absolute_paths: bool = False
- display_guest: str = 'auto'
- open: bool = False
tmt.steps.report.junit module
- class tmt.steps.report.junit.ReportJUnit(*, step: Step, data: StepDataT, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
ReportPlugin[ReportJUnitData]Save test results in JUnit format.
When
fileis not specified, output is written into a file namedjunit.xmllocated in the current workdir.Store plugin name, data and parent step
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- class tmt.steps.report.junit.ReportJUnitData(name: str, how: str, order: int = 50, summary: str | None = None, file: tmt._compat.pathlib.Path | None = None, include_output_log: bool = True)
Bases:
ReportStepData- file: Path | None = None
- include_output_log: bool = True
- tmt.steps.report.junit.duration_to_seconds(duration: str) int
- tmt.steps.report.junit.duration_to_seconds(duration: None) None
Convert valid duration string in to seconds
- tmt.steps.report.junit.make_junit_xml(report: ReportPlugin[ReportJUnitData] | ReportPlugin[ReportPolarionData]) junit_xml.TestSuite
Create junit xml object
tmt.steps.report.polarion module
- class tmt.steps.report.polarion.ReportPolarion(*, step: Step, data: StepDataT, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
ReportPlugin[ReportPolarionData]Write test results into an xUnit file and upload to Polarion
Store plugin name, data and parent step
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- class tmt.steps.report.polarion.ReportPolarionData(name: str, how: str, order: int = 50, summary: str | None = None, file: tmt._compat.pathlib.Path | None = None, upload: bool = True, project_id: str | None = None, title: str | None = None, description: str | None = None, template: str | None = None, use_facts: bool = False, planned_in: str | None = None, assignee: str | None = None, pool_team: str | None = None, arch: str | None = None, platform: str | None = None, build: str | None = None, sample_image: str | None = None, logs: str | None = None, compose_id: str | None = None, fips: bool = False, include_output_log: bool = True)
Bases:
ReportStepData- arch: str | None = None
- assignee: str | None = None
- build: str | None = None
- compose_id: str | None = None
- description: str | None = None
- file: Path | None = None
- fips: bool = False
- include_output_log: bool = True
- logs: str | None = None
- planned_in: str | None = None
- platform: str | None = None
- pool_team: str | None = None
- project_id: str | None = None
- sample_image: str | None = None
- template: str | None = None
- title: str | None = None
- upload: bool = True
- use_facts: bool = False
tmt.steps.report.reportportal module
- class tmt.steps.report.reportportal.ReportReportPortal(*, step: Step, data: StepDataT, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
ReportPlugin[ReportReportPortalData]Report test results to a ReportPortal instance via API.
For communication with Report Portal API is necessary to provide following options:
token for authentication
url of the ReportPortal instance
project name
In addition to command line options it’s possible to use environment variables:
export TMT_PLUGIN_REPORT_REPORTPORTAL_${MY_OPTION}=${MY_VALUE}
Assuming the URL and token are provided by the environment variables, the plan config can look like this:
report: how: reportportal project: baseosqe context: ... environment: ...
Where the context and environment sections must be filled with corresponding data in order to report context as attributes (arch, component, distro, trigger, compose, etc.) and environment variables as parameters in the Item Details.
Other reported fmf data are summary, id, web link and contact per test.
Two types of data structures are supported for reporting to ReportPortal:
‘launch-per-plan’ mapping (default) that results in launch-test structure.
‘suite-per-plan’ mapping that results in launch-suite-test structure.
Supported report use cases:
Report a new run in launch-suite-test or launch-test structure
Report an additional rerun with ‘launch-rerun’ option and same launch name (->Retry items) or by reusing the run and reporting with ‘again’ option (->append logs)
To see plan progress, discover and report an empty (IDLE) run and reuse the run for execution and updating the report with ‘again’ option
Report contents of a new run to an existing launch via the URL ID in three ways: tests to launch, suites to launch and tests to suite.
Store plugin name, data and parent step
- TMT_TO_RP_RESULT_STATUS = {ResultOutcome.ERROR: 'FAILED', ResultOutcome.FAIL: 'FAILED', ResultOutcome.INFO: 'SKIPPED', ResultOutcome.PASS: 'PASSED', ResultOutcome.WARN: 'FAILED'}
- append_description(curr_description: str) str
Extend text with the launch description (if provided)
- check_options() None
Check options for known troublesome combinations
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- construct_launch_attributes(suite_per_plan: bool, attributes: list[dict[str, str]]) list[dict[str, str]]
- get_defect_type_locator(session: Session, defect_type: str | None) str
- get_headers() dict[str, str]
- get_url() str
- go(*, logger: Logger | None = None) None
Report test results to the endpoint
Create a ReportPortal launch and its test items, fill it with all parts needed and report the logs.
- handle_response(response: Response) None
Check the endpoint response and raise an exception if needed
- rp_api_get(session: Session, path: str) Response
- rp_api_post(session: Session, path: str, json: Any) Response
- rp_api_put(session: Session, path: str, json: Any) Response
- time() str
- class tmt.steps.report.reportportal.ReportReportPortalData(name: str, how: str, order: int = 50, summary: Optional[str] = None, url: Optional[str] = None, token: Optional[str] = None, project: Optional[str] = None, launch: Optional[str] = None, launch_description: Optional[str] = None, launch_per_plan: bool = False, suite_per_plan: bool = False, upload_to_launch: Optional[str] = None, upload_to_suite: Optional[str] = None, launch_rerun: bool = False, defect_type: Optional[str] = None, exclude_variables: str = '^TMT_.*', api_version: str = 'v1', artifacts_url: Optional[str] = None, launch_url: Optional[str] = None, launch_uuid: Optional[str] = None, suite_uuid: Optional[str] = None, test_uuids: dict[int, str] = <factory>)
Bases:
ReportStepData- api_version: str = 'v1'
- artifacts_url: str | None = None
- defect_type: str | None = None
- exclude_variables: str = '^TMT_.*'
- launch: str | None = None
- launch_description: str | None = None
- launch_per_plan: bool = False
- launch_rerun: bool = False
- launch_url: str | None = None
- launch_uuid: str | None = None
- project: str | None = None
- suite_per_plan: bool = False
- suite_uuid: str | None = None
- test_uuids: dict[int, str]
- token: str | None = None
- upload_to_launch: str | None = None
- upload_to_suite: str | None = None
- url: str | None = None
Module contents
- class tmt.steps.report.Report(*, plan: Plan, data: _RawStepData | list[_RawStepData] | None = None, name: str | None = None, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
StepProvide test results overview and send reports.
Initialize and check the step data
- DEFAULT_HOW: str = 'display'
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- cli_invocations: list['tmt.cli.CliInvocation'] = []
- go(force: bool = False) None
Report the results
- summary() None
Give a concise report summary
- wake() None
Wake up the step (process workdir and command line)
- class tmt.steps.report.ReportPlugin(*, step: Step, data: StepDataT, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
GuestlessPlugin[ReportStepDataT,None]Common parent of report plugins
Store plugin name, data and parent step
- classmethod base_command(usage: str, method_class: type[Command] | None = None) Command
Create base click command (common for all report plugins)
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- go(*, logger: Logger | None = None) None
Perform actions shared among plugins when beginning their tasks
- how: str = 'display'