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
/-v
options given on command line. For1
, display only test name and its result,2
will add log paths, and3
or more would show the test output as well.display_guest – if set, guest multihost name would be part of the report.
- go() None
Discover available tests
- 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
- go() None
Process results
- 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
file
is not specified, output is written into a file namedjunit.xml
located in the current workdir.Store plugin name, data and parent step
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- go() None
Read executed tests and write junit
- class tmt.steps.report.junit.ReportJUnitData(name: str, how: str, order: int = 50, summary: str | None = None, file: tmt.utils.Path | None = None)
Bases:
ReportStepData
- 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.import_junit_xml() None
Import junit_xml module only when needed
- tmt.steps.report.junit.make_junit_xml(report: ReportPlugin[ReportStepDataT]) Any
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
- go() None
Go through executed tests and report into Polarion
- class tmt.steps.report.polarion.ReportPolarionData(name: str, how: str, order: int = 50, summary: str | None = None, file: tmt.utils.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)
Bases:
ReportStepData
- arch: str | None = None
- assignee: str | None = None
- build: str | None = None
- compose_id: str | None = None
- description: str | None = None
- fips: bool = False
- 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 neccessary 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.
There are supported two ways of mapping plans into ReportPortal
launch-per-plan (default) with reported structure ‘launch > test’, resulting in one or more launches.
suite-per-plan with reported structure ‘launch > suite > test’ resulting in one launch only, and one or more suites within. It is recommended to define launch name and launch description in addition.
Store plugin name, data and parent step
- TMT_TO_RP_RESULT_STATUS = {<ResultOutcome.PASS: 'pass'>: 'PASSED', <ResultOutcome.FAIL: 'fail'>: 'FAILED', <ResultOutcome.ERROR: 'error'>: 'FAILED', <ResultOutcome.WARN: 'warn'>: 'FAILED', <ResultOutcome.INFO: 'info'>: 'SKIPPED'}
- append_description(curr_description: str) str
Extend text with the launch description (if provided)
- check_options() None
Write warning if there might be caused an unexpected behaviour by the option 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_rp_api(session: Session, data_path: str) Response
- get_url() str
- go() 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.
- 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[tmt.steps._RawStepData] | None = None, name: str | None = None, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
Step
Provide 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
]Common parent of report plugins
Store plugin name, data and parent step
- classmethod base_command(usage: str, method_class: type[click.core.Command] | None = None) Command
Create base click command (common for all report plugins)
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- how: str = 'display'