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. For 1, display only test name and its result, 2 will add log paths, and 3 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

prune(logger: Logger) None

Do not prune generated html report

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]

Write test results in JUnit format

When FILE is not specified output is written to the ‘junit.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

prune(logger: Logger) None

Do not prune generated junit report

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

file: Path | None = None
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 a 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

prune(logger: Logger) None

Do not prune generated xunit report

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
file: Path | 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.

Requires a TOKEN for authentication, a URL of the ReportPortal instance and the PROJECT name. In addition to command line options it’s possible to use environment variables to set the url and token:

export TMT_REPORT_REPORTPORTAL_URL=… export TMT_REPORT_REPORTPORTAL_TOKEN=…

The optional LAUNCH name doesn’t have to be provided if it is the same as the plan name (by default). Assuming the URL and TOKEN variables are provided by the environment, the plan config can look like this:

report:

how: reportportal project: baseosqe

context:

environment:

The context and environment sections must be filled in order to report context as attributes and environment variables as parameters in the Item Details. Environment variables can be filtered out by pattern to prevent overloading and to preserve the history aggregation for ReportPortal item if tmt id is not provided. Other reported fmf data are summary, id, web link and contact per test.

Store plugin name, data and parent step

DEFAULT_API_VERSION = 'v1'
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'}
cli_invocation: 'tmt.cli.CliInvocation' | None = None
go() None

Report test results to the server

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 server response and raise an exception if needed.

class tmt.steps.report.reportportal.ReportReportPortalData(name: str, how: str, order: int = 50, summary: str | None = None, url: str | None = None, token: str | None = None, project: str | None = None, launch: str | None = None, exclude_variables: str = '^TMT_.*')

Bases: ReportStepData

exclude_variables: str = '^TMT_.*'
launch: str | None = None
project: str | None = None
token: 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'
class tmt.steps.report.ReportStepData(name: str, how: str, order: int = 50, summary: str | None = None)

Bases: StepData