tmt.export package

Submodules

tmt.export.nitrate module

class tmt.export.nitrate.NitrateExporter

Bases: ExportPlugin

classmethod export_test_collection(tests: list[tmt.base.Test], keys: list[str] | None = None, **kwargs: Any) str

Export collection of tests

tmt.export.nitrate.add_to_nitrate_runs(nitrate_case: Any, general_plan: Any, test: Test, dry_mode: bool) None

Add nitrate test case to all active runs under given general plan

Go down plan tree from general plan, add case and case run to all open runs. Try to apply adjust.

tmt.export.nitrate.convert_manual_to_nitrate(test_md: Path) tuple[str, str, str, str]

Convert Markdown document to html sections.

These sections can be exported to nitrate. Expects: Markdown document as a file. Returns: tuple of (step, expect, setup, cleanup) sections as html strings.

tmt.export.nitrate.create_nitrate_case(summary: str, category: str) Any

Create new nitrate case

tmt.export.nitrate.enabled_for_environment(test: Test, tcms_notes: str) bool

Check whether test is enabled for specified environment

tmt.export.nitrate.enabled_somewhere(test: Test) bool

True if the test is enabled for some context (adjust rules)

tmt.export.nitrate.export_to_nitrate(test: Test) None

Export fmf metadata to nitrate test cases

tmt.export.nitrate.find_general_plan(component: str) Any

Return single General Test Plan or raise an error

tmt.export.nitrate.get_category(path: Path) str

Get category from Makefile

tmt.export.nitrate.import_nitrate() Any

Conditionally import the nitrate module

tmt.export.nitrate.prepare_extra_summary(test: Test, append_summary: bool) str

extra-summary for export –create test

tmt.export.nitrate.return_markdown_file() Path | None

Return path to the markdown file

tmt.export.polarion module

class tmt.export.polarion.PolarionExporter

Bases: ExportPlugin

classmethod export_test_collection(tests: list[tmt.base.Test], keys: list[str] | None = None, **kwargs: Any) str

Export collection of tests

Add new hyperlink to a Polarion case and check/remove duplicates

tmt.export.polarion.create_polarion_case(summary: str, project_id: str, path: Path) None

Create new polarion case

tmt.export.polarion.export_to_polarion(test: Test) None

Export fmf metadata to a Polarion test case

tmt.export.polarion.find_polarion_case_ids(data: dict[str, Optional[str]], preferred_project: str | None = None, polarion_case_id: str | None = None) tuple[str, Optional[str]]

Find IDs for Polarion case from data dictionary

tmt.export.polarion.get_polarion_case(data: dict[str, Optional[str]], preferred_project: str | None = None, polarion_case_id: str | None = None) None

Get Polarion case through couple different methods

tmt.export.polarion.get_polarion_ids(query_result: list[Any], preferred_project: str | None = None) tuple[str, Optional[str]]

Return case and project ids from query results

tmt.export.polarion.import_polarion() None

Import polarion python api - pylero

tmt.export.rst module

class tmt.export.rst.RestructuredExporter

Bases: ExportPlugin

classmethod export_story(story: Story, keys: list[str] | None = None, template: Path | None = None, include_title: bool = True) str
classmethod export_story_collection(stories: list[tmt.base.Story], keys: list[str] | None = None, template: Path | None = None, include_title: bool = True, **kwargs: Any) str

Export collection of stories

tmt.export.template module

class tmt.export.template.TemplateExporter

Bases: ExportPlugin

classmethod export_fmfid_collection(fmf_ids: list[tmt.base.FmfId], keys: list[str] | None = None, template: Path | None = None, **kwargs: Any) str

Export collection of fmf ids

classmethod export_plan_collection(plans: list[tmt.base.Plan], keys: list[str] | None = None, template: Path | None = None, **kwargs: Any) str

Export collection of plans

classmethod export_story_collection(stories: list[tmt.base.Story], keys: list[str] | None = None, template: Path | None = None, include_title: bool = True, **kwargs: Any) str

Export collection of stories

classmethod export_test_collection(tests: list[tmt.base.Test], keys: list[str] | None = None, template: Path | None = None, **kwargs: Any) str

Export collection of tests

classmethod render_template(*, template_filepath: Path | None = None, default_template_filename: str, keys: list[str] | None = None, **variables: Any) str

tmt.export.yaml module

class tmt.export.yaml.YAMLExporter

Bases: TrivialExporter

Module contents

Metadata export functionality core.

Internal APIs, plugin classes and shared functionality and helpers for metadata export of tests, plans or stories.

class tmt.export.ExportPlugin

Bases: object

Base class for plugins providing metadata export functionality

classmethod export_fmfid_collection(fmf_ids: list[tmt.base.FmfId], **kwargs: Any) str

Export collection of fmf ids

classmethod export_plan_collection(plans: list[tmt.base.Plan], keys: list[str] | None = None, **kwargs: Any) str

Export collection of plans

classmethod export_story_collection(stories: list[tmt.base.Story], keys: list[str] | None = None, **kwargs: Any) str

Export collection of stories

classmethod export_test_collection(tests: list[tmt.base.Test], keys: list[str] | None = None, **kwargs: Any) str

Export collection of tests

class tmt.export.Exportable(*args: Any, **kwargs: Any)

Bases: Generic[ExportableT], _CommonBase

Mixin class adding support for exportability of class instances

export(*, format: str, keys: list[str] | None = None, **kwargs: Any) str

Export this instance in a given format

classmethod export_collection(*, collection: list[ExportableT], format: str, keys: list[str] | None = None, **kwargs: Any) str

Export collection of instances in a given format

classmethod get_export_plugin_registry() PluginRegistry[type[tmt.export.ExportPlugin]]

Return - or initialize - export plugin registry

classmethod provides_export(format: str) Callable[[type[tmt.export.ExportPlugin]], type[tmt.export.ExportPlugin]]

A decorator for registering export format.

Decorate an export plugin class to register a format.

class tmt.export.Exporter(*args, **kwargs)

Bases: Protocol

class tmt.export.TrivialExporter

Bases: ExportPlugin

A helper base class for exporters with trivial export procedure.

Child classes need to implement a single method that performs a conversion of a single collection item, and that’s all. It is good enough for formats like dict or YAML as they do not require any other input than the data to convert.

classmethod export_fmfid_collection(fmf_ids: list[tmt.base.FmfId], keys: list[str] | None = None, **kwargs: Any) str

Export collection of fmf ids

classmethod export_plan_collection(plans: list[tmt.base.Plan], keys: list[str] | None = None, **kwargs: Any) str

Export collection of plans

classmethod export_story_collection(stories: list[tmt.base.Story], keys: list[str] | None = None, **kwargs: Any) str

Export collection of stories

classmethod export_test_collection(tests: list[tmt.base.Test], keys: list[str] | None = None, **kwargs: Any) str

Export collection of tests

tmt.export.bz_set_coverage(bug_ids: list[int], case_id: str, tracker_id: int) None

Set coverage in Bugzilla

tmt.export.check_md_file_respects_spec(md_path: Path) list[str]

Check that the file respects manual test specification

Return list of warnings, empty list if no problems found.

tmt.export.get_bz_instance() Any

Import the bugzilla module and return BZ instance