tmt.steps package
Subpackages
- tmt.steps.cleanup package
- tmt.steps.context package
- tmt.steps.discover package
- Submodules
- tmt.steps.discover.fmf module
DiscoverFmfDiscoverFmfStepDataDiscoverFmfStepData.adjust_testsDiscoverFmfStepData.dist_git_extractDiscoverFmfStepData.dist_git_initDiscoverFmfStepData.dist_git_mergeDiscoverFmfStepData.dist_git_remove_fmf_rootDiscoverFmfStepData.excludeDiscoverFmfStepData.filterDiscoverFmfStepData.fmf_idDiscoverFmfStepData.includeDiscoverFmfStepData.linkDiscoverFmfStepData.modified_onlyDiscoverFmfStepData.modified_refDiscoverFmfStepData.modified_urlDiscoverFmfStepData.pathDiscoverFmfStepData.post_normalization()DiscoverFmfStepData.pruneDiscoverFmfStepData.refDiscoverFmfStepData.repositoryDiscoverFmfStepData.revisionDiscoverFmfStepData.sync_repoDiscoverFmfStepData.testDiscoverFmfStepData.upgrade_pathDiscoverFmfStepData.urlDiscoverFmfStepData.url_content_type
normalize_ref()
- tmt.steps.discover.shell module
DiscoverShellDiscoverShellDataTestDescriptionTestDescription.adjustTestDescription.authorTestDescription.checkTestDescription.componentTestDescription.contactTestDescription.descriptionTestDescription.durationTestDescription.enabledTestDescription.environmentTestDescription.frameworkTestDescription.from_spec()TestDescription.idTestDescription.linkTestDescription.manualTestDescription.nameTestDescription.orderTestDescription.pathTestDescription.recommendTestDescription.requireTestDescription.resultTestDescription.summaryTestDescription.tagTestDescription.testTestDescription.tierTestDescription.to_spec()TestDescription.tty
- Module contents
- tmt.steps.execute package
- Submodules
- tmt.steps.execute.internal module
- tmt.steps.execute.upgrade module
- Module contents
ExecuteExecutePluginExecutePlugin.base_command()ExecutePlugin.cli_invocationExecutePlugin.discoverExecutePlugin.discover_phaseExecutePlugin.extract_custom_results()ExecutePlugin.extract_results()ExecutePlugin.extract_tmt_report_results()ExecutePlugin.extract_tmt_report_results_restraint()ExecutePlugin.go()ExecutePlugin.howExecutePlugin.prepare_tests()ExecutePlugin.results()ExecutePlugin.run_checks_after_test()ExecutePlugin.run_checks_before_test()ExecutePlugin.run_internal_checks()ExecutePlugin.timeout_hint()
ExecuteStepDataResultCollectionTestInvocationTestInvocation.abortTestInvocation.check_dataTestInvocation.check_files_pathTestInvocation.check_resultsTestInvocation.end_timeTestInvocation.exceptionsTestInvocation.guestTestInvocation.invoke_test()TestInvocation.is_guest_healthyTestInvocation.loggerTestInvocation.on_interrupt_callback_tokenTestInvocation.pathTestInvocation.phaseTestInvocation.pidfileTestInvocation.processTestInvocation.process_lockTestInvocation.real_durationTestInvocation.rebootTestInvocation.relative_pathTestInvocation.relative_test_data_pathTestInvocation.restartTestInvocation.restraintTestInvocation.resultsTestInvocation.return_codeTestInvocation.start_timeTestInvocation.step_workdirTestInvocation.submission_log_pathTestInvocation.submitted_filesTestInvocation.terminate_process()TestInvocation.testTestInvocation.test_data_path
- tmt.steps.finish package
- tmt.steps.prepare package
- Subpackages
- Submodules
- tmt.steps.prepare.ansible module
- tmt.steps.prepare.distgit module
- tmt.steps.prepare.install module
CoprInstallApkInstallAptInstallBaseInstallBase.cli_invocationInstallBase.debuginfo_packagesInstallBase.excludeInstallBase.guestInstallBase.install()InstallBase.install_debuginfo()InstallBase.install_from_repository()InstallBase.install_from_url()InstallBase.install_local()InstallBase.list_installables()InstallBase.local_packagesInstallBase.package_directoryInstallBase.packagesInstallBase.prepare_install_local()InstallBase.prepare_installables()InstallBase.remote_packagesInstallBase.rpm_check()InstallBase.skip_missing
InstallBootcInstallDnfInstallDnf5InstallMockInstallRpmOstreeInstallRpmOstree.cli_invocationInstallRpmOstree.copr_pluginInstallRpmOstree.enable_copr()InstallRpmOstree.install_debuginfo()InstallRpmOstree.install_from_repository()InstallRpmOstree.install_local()InstallRpmOstree.recommended_packagesInstallRpmOstree.required_packagesInstallRpmOstree.sort_packages()
InstallYumPrepareInstallPrepareInstallData
- tmt.steps.prepare.shell module
- Module contents
- tmt.steps.provision package
- Submodules
- tmt.steps.provision.artemis module
ArtemisAPIArtemisGuestDataArtemisGuestData.api_retriesArtemisGuestData.api_retry_backoff_factorArtemisGuestData.api_timeoutArtemisGuestData.api_urlArtemisGuestData.api_versionArtemisGuestData.archArtemisGuestData.guestnameArtemisGuestData.imageArtemisGuestData.keynameArtemisGuestData.kickstartArtemisGuestData.log_typeArtemisGuestData.poolArtemisGuestData.post_install_scriptArtemisGuestData.priority_groupArtemisGuestData.provision_tickArtemisGuestData.provision_timeoutArtemisGuestData.skip_prepare_verify_sshArtemisGuestData.user_dataArtemisGuestData.watchdog_dispatch_delayArtemisGuestData.watchdog_period_delay
ArtemisProvisionErrorGuestArtemisGuestArtemis.apiGuestArtemis.api_retriesGuestArtemis.api_retry_backoff_factorGuestArtemis.api_timeoutGuestArtemis.api_urlGuestArtemis.api_versionGuestArtemis.archGuestArtemis.cli_invocationGuestArtemis.guestnameGuestArtemis.imageGuestArtemis.is_readyGuestArtemis.keynameGuestArtemis.kickstartGuestArtemis.log_typeGuestArtemis.poolGuestArtemis.post_install_scriptGuestArtemis.priority_groupGuestArtemis.provision_tickGuestArtemis.provision_timeoutGuestArtemis.reboot()GuestArtemis.remove()GuestArtemis.skip_prepare_verify_sshGuestArtemis.start()GuestArtemis.user_dataGuestArtemis.watchdog_dispatch_delayGuestArtemis.watchdog_period_delay
GuestInspectTypeGuestLogArtemisGuestLogBlobTypeProvisionArtemisProvisionArtemisData
- tmt.steps.provision.bootc module
- tmt.steps.provision.connect module
- tmt.steps.provision.local module
- tmt.steps.provision.mock module
- tmt.steps.provision.mrack module
BEAKERBeakerAPIBeakerGuestDataBeakerGuestData.api_session_refresh_tickBeakerGuestData.archBeakerGuestData.beaker_job_groupBeakerGuestData.beaker_job_ownerBeakerGuestData.bootcBeakerGuestData.bootc_check_system_urlBeakerGuestData.bootc_image_urlBeakerGuestData.bootc_registry_secretBeakerGuestData.imageBeakerGuestData.job_idBeakerGuestData.kickstartBeakerGuestData.provision_tickBeakerGuestData.provision_timeoutBeakerGuestData.public_keyBeakerGuestData.whiteboard
BeakerProviderBeakerTransformerConstraintTConstraintTransformerCreateJobParametersCreateJobParameters.archCreateJobParameters.beaker_job_groupCreateJobParameters.beaker_job_ownerCreateJobParameters.bootcCreateJobParameters.bootc_check_system_urlCreateJobParameters.bootc_credentialsCreateJobParameters.bootc_image_urlCreateJobParameters.groupCreateJobParameters.hardwareCreateJobParameters.kickstartCreateJobParameters.nameCreateJobParameters.osCreateJobParameters.public_keyCreateJobParameters.tmt_nameCreateJobParameters.to_mrack()CreateJobParameters.whiteboard
DEFAULT_API_SESSION_REFRESHGuestBeakerGuestBeaker.apiGuestBeaker.api_session_refresh_tickGuestBeaker.archGuestBeaker.beaker_job_groupGuestBeaker.beaker_job_ownerGuestBeaker.bootcGuestBeaker.bootc_check_system_urlGuestBeaker.bootc_image_urlGuestBeaker.bootc_registry_secretGuestBeaker.cli_invocationGuestBeaker.hardwareGuestBeaker.imageGuestBeaker.is_readyGuestBeaker.job_idGuestBeaker.kickstartGuestBeaker.provision_tickGuestBeaker.provision_timeoutGuestBeaker.public_keyGuestBeaker.reboot()GuestBeaker.remove()GuestBeaker.start()GuestBeaker.whiteboard
GuestInspectTypeGuestLogBeakerMrackBaseHWElementMrackHWAndGroupMrackHWBinOpMrackHWDeviceElementMrackHWElementMrackHWGroupMrackHWKeyValueMrackHWNotGroupMrackHWOrGroupNotAuthenticatedErrorProvisionBeakerProvisionBeakerDataProvisioningErrorTmtBeakerTransformerasync_run()constraint_to_beaker_filter()import_and_load_mrack_deps()init_mrack_global_context()mrackmrack_constructs_ks_pre()operator_to_beaker_op()providerstransforms()
- tmt.steps.provision.podman module
GuestContainerGuestContainer.cli_invocationGuestContainer.containerGuestContainer.execute()GuestContainer.force_pullGuestContainer.imageGuestContainer.is_readyGuestContainer.loggerGuestContainer.podman()GuestContainer.pull()GuestContainer.pull_attemptsGuestContainer.pull_image()GuestContainer.pull_intervalGuestContainer.push()GuestContainer.reboot()GuestContainer.remove()GuestContainer.start()GuestContainer.stop()GuestContainer.stop_timeGuestContainer.userGuestContainer.wake()
PodmanGuestDataProvisionPodmanProvisionPodmanData
- tmt.steps.provision.testcloud module
AArch64ArchitectureConfigurationBOOT_TIMEOUTConsoleLogDEFAULT_BOOT_TIMEOUTDEFAULT_STOP_RETRIESDEFAULT_STOP_RETRY_DELAYDomainConfigurationGuestTestcloudGuestTestcloud.archGuestTestcloud.cli_invocationGuestTestcloud.connectionGuestTestcloud.diskGuestTestcloud.imageGuestTestcloud.image_urlGuestTestcloud.instance_nameGuestTestcloud.is_coreosGuestTestcloud.is_kvmGuestTestcloud.is_legacy_osGuestTestcloud.is_readyGuestTestcloud.memoryGuestTestcloud.prepare_config()GuestTestcloud.prepare_ssh_key()GuestTestcloud.reboot()GuestTestcloud.remove()GuestTestcloud.start()GuestTestcloud.stop()GuestTestcloud.stop_retriesGuestTestcloud.stop_retry_delayGuestTestcloud.testcloud_data_dirpathGuestTestcloud.testcloud_image_dirpathGuestTestcloud.wake()
IMAGE_URL_FETCH_RETRY_ATTEMPTSNON_KVM_TIMEOUT_COEFPpc64leArchitectureConfigurationProvisionTestcloudProvisionTestcloudDataQCow2StorageDeviceRawStorageDeviceS390xArchitectureConfigurationSystemNetworkConfigurationTPMConfigurationTPM_CONFIG_ALLOWS_VERSIONSTPM_VERSION_ALLOWED_OPERATORSTPM_VERSION_SUPPORTED_VERSIONSTestcloudGuestDataTestcloudGuestData.archTestcloudGuestData.connectionTestcloudGuestData.diskTestcloudGuestData.imageTestcloudGuestData.image_urlTestcloudGuestData.instance_nameTestcloudGuestData.list_local_imagesTestcloudGuestData.memoryTestcloudGuestData.show()TestcloudGuestData.stop_retriesTestcloudGuestData.stop_retry_delay
UserNetworkConfigurationWorkaroundsX86_64ArchitectureConfigurationimport_testcloud()normalize_disk_size()normalize_memory_size()
- Module contents
BASE_SSH_OPTIONSBootMarkBootMarkBootTimeBootMarkSystemdSoftRebootCountCONNECT_TIMEOUTDEFAULT_CONNECT_TIMEOUTDEFAULT_REBOOT_TIMEOUTDEFAULT_SSH_OPTIONSDEFAULT_USERGuestGuest.ansibleGuest.ansible_host_groupsGuest.ansible_host_varsGuest.assert_reachable()Guest.becomeGuest.bootc_builderGuest.cli_invocationGuest.environmentGuest.essential_requires()Guest.execute()Guest.factsGuest.fetch_logs()Guest.get_data_class()Guest.guest_workdirGuest.hardwareGuest.install_scripts()Guest.is_readyGuest.load()Guest.localhostGuest.logdirGuest.mkdtemp()Guest.multihost_nameGuest.options()Guest.package_managerGuest.perform_reboot()Guest.plan_workdirGuest.primary_addressGuest.pull()Guest.push()Guest.reboot()Guest.reconnect()Guest.remove()Guest.roleGuest.run_ansible_playbook()Guest.run_workdirGuest.save()Guest.scripts_pathGuest.setup()Guest.show()Guest.start()Guest.step_workdirGuest.stop()Guest.suspend()Guest.topology_addressGuest.wake()
GuestCapabilityGuestDataGuestFactsGuestFacts.archGuestFacts.bootc_builderGuestFacts.can_sudoGuestFacts.capabilitiesGuestFacts.distroGuestFacts.format()GuestFacts.has_capability()GuestFacts.has_rsyncGuestFacts.has_selinuxGuestFacts.has_systemdGuestFacts.in_syncGuestFacts.is_containerGuestFacts.is_ostreeGuestFacts.is_superuserGuestFacts.is_toolboxGuestFacts.kernel_releaseGuestFacts.lsb_release_contentGuestFacts.os_release_contentGuestFacts.package_managerGuestFacts.sudo_prefixGuestFacts.sync()GuestFacts.systemd_soft_rebootGuestFacts.toolbox_container_name
GuestLogGuestSshGuestSsh.ansible_host_varsGuestSsh.cli_invocationGuestSsh.execute()GuestSsh.is_readyGuestSsh.is_ssh_multiplexing_enabledGuestSsh.keyGuestSsh.passwordGuestSsh.portGuestSsh.pull()GuestSsh.push()GuestSsh.reboot()GuestSsh.remove()GuestSsh.setup()GuestSsh.ssh_optionGuestSsh.stop()GuestSsh.suspend()GuestSsh.user
GuestSshDataProvisionProvision.DEFAULT_HOWProvision.ansible_inventory_pathProvision.cli_invocationProvision.cli_invocationsProvision.get_guests_info()Provision.go()Provision.guestsProvision.is_multihostProvision.load()Provision.ready_guestsProvision.save()Provision.summary()Provision.suspend()Provision.wake()
ProvisionPluginProvisionQueueProvisionStepDataProvisionTaskREBOOT_TIMEOUTRebootModeRebootModeNotSupportedErrorSSH_MASTER_SOCKET_LENGTH_LIMITSSH_MASTER_SOCKET_MAX_HASH_LENGTHSSH_MASTER_SOCKET_MIN_HASH_LENGTHSTAT_BTIME_PATTERNTransferOptionsTransferOptions.chmodTransferOptions.compressTransferOptions.copy()TransferOptions.create_destinationTransferOptions.deleteTransferOptions.excludeTransferOptions.linksTransferOptions.preserve_permsTransferOptions.protect_argsTransferOptions.recursiveTransferOptions.relativeTransferOptions.safe_linksTransferOptions.to_rsync()
configure_ssh_options()default_connect_waiting()default_reboot_waiting()default_reconnect_waiting()essential_ansible_requires()format_guest_full_name()normalize_hardware()
- tmt.steps.report package
- Submodules
- tmt.steps.report.display module
ReportDisplayReportDisplayDataResultRendererResultRenderer.basepathResultRenderer.display_guestResultRenderer.loggerResultRenderer.note_templateResultRenderer.print_result()ResultRenderer.print_results()ResultRenderer.render_check_result()ResultRenderer.render_check_results()ResultRenderer.render_log_content()ResultRenderer.render_log_info()ResultRenderer.render_logs_content()ResultRenderer.render_logs_info()ResultRenderer.render_note()ResultRenderer.render_notes()ResultRenderer.render_result()ResultRenderer.render_results()ResultRenderer.render_subresult()ResultRenderer.render_subresults()ResultRenderer.result_check_header_templateResultRenderer.result_header_templateResultRenderer.shiftResultRenderer.subresult_check_header_templateResultRenderer.subresult_header_templateResultRenderer.variablesResultRenderer.verbosity
- tmt.steps.report.html module
- tmt.steps.report.junit module
- tmt.steps.report.polarion module
ReportPolarionReportPolarionDataReportPolarionData.archReportPolarionData.assigneeReportPolarionData.buildReportPolarionData.compose_idReportPolarionData.descriptionReportPolarionData.fileReportPolarionData.fipsReportPolarionData.include_output_logReportPolarionData.logsReportPolarionData.planned_inReportPolarionData.platformReportPolarionData.pool_teamReportPolarionData.prettifyReportPolarionData.project_idReportPolarionData.sample_imageReportPolarionData.templateReportPolarionData.test_cycleReportPolarionData.titleReportPolarionData.uploadReportPolarionData.use_facts
- tmt.steps.report.reportportal module
LogFilterSettingsReportReportPortalReportReportPortal.TMT_TO_RP_RESULT_STATUSReportReportPortal.append_description()ReportReportPortal.append_link_template()ReportReportPortal.check_options()ReportReportPortal.cli_invocationReportReportPortal.construct_item_attributes()ReportReportPortal.construct_launch_attributes()ReportReportPortal.datetimeReportReportPortal.execute_rp_import()ReportReportPortal.get_defect_type_locator()ReportReportPortal.go()ReportReportPortal.handle_response()ReportReportPortal.headersReportReportPortal.rp_api_get()ReportReportPortal.rp_api_post()ReportReportPortal.rp_api_put()ReportReportPortal.upload_result_logs()ReportReportPortal.url
ReportReportPortalDataReportReportPortalData.api_versionReportReportPortalData.artifacts_urlReportReportPortalData.auto_analysisReportReportPortalData.defect_typeReportReportPortalData.exclude_variablesReportReportPortalData.launchReportReportPortalData.launch_descriptionReportReportPortalData.launch_per_planReportReportPortalData.launch_rerunReportReportPortalData.launch_urlReportReportPortalData.launch_uuidReportReportPortalData.link_templateReportReportPortalData.log_size_limitReportReportPortalData.projectReportReportPortalData.ssl_verifyReportReportPortalData.suite_per_planReportReportPortalData.suite_uuidReportReportPortalData.test_uuidsReportReportPortalData.tokenReportReportPortalData.traceback_size_limitReportReportPortalData.upload_log_patternReportReportPortalData.upload_subresultsReportReportPortalData.upload_to_launchReportReportPortalData.upload_to_suiteReportReportPortalData.url
- Module contents
Submodules
tmt.steps.scripts module
- tmt.steps.scripts.DEFAULT_SCRIPTS_DEST_DIR = Path('/usr/local/bin')
The default scripts destination directory
- tmt.steps.scripts.DEFAULT_SCRIPTS_DEST_DIR_OSTREE = Path('/var/lib/tmt/scripts')
The default scripts destination directory for rpm-ostree based distributions, https://github.com/teemtee/tmt/discussions/3260
- tmt.steps.scripts.SCRIPTS_DEST_DIR_VARIABLE = 'TMT_SCRIPTS_DIR'
The tmt environment variable name for forcing
SCRIPTS_DEST_DIR
- tmt.steps.scripts.SCRIPTS_DIR_NAME = 'scripts'
The directory where helper scripts will be copied
- tmt.steps.scripts.SCRIPTS_RESOURCE = 'steps/scripts'
Scripts source resource. Use tmt.utils.resource_files to access them.
- class tmt.steps.scripts.Script(source_filename: str, destination_path: Path | None, aliases: list[str], related_variables: list[str], enabled: Callable[[Guest], bool])
Bases:
objectRepresents a script provided by the internal executor.
Must be used as a context manager. The context manager returns the source filename.
The source file is defined by the
source_filenameattribute and its location is relative to the directory specified via theSCRIPTS_SRC_DIRvariable. All scripts must be located in this directory.The default destination directory of the scripts is
DEFAULT_SCRIPTS_DEST_DIR. Onrpm-ostreedistributions like Fedora CoreOS, the default destination directory is :py:data:DEFAULT_SCRIPTS_DEST_DIR_OSTREE. The destination directory of the scripts can be forced by the script usingdestination_pathattribute.The destination directory can be overridden using the environment variable defined by the
DEFAULT_SCRIPTS_DEST_DIR_VARIABLEvariable.The
enabledattribute can specify a function which is called withGuestinstance to evaluate if the script is enabled. This can be useful to optionally disable a script for specific guests.- aliases: list[str]
- destination_path: Path | None
- source_filename: str
- class tmt.steps.scripts.ScriptCreatingFile(source_filename: str, destination_path: Path | None, aliases: list[str], related_variables: list[str], enabled: Callable[[Guest], bool], created_file: str)
Bases:
ScriptRepresents a script which creates a file.
See
Scriptfor more details.- created_file: str
- class tmt.steps.scripts.ScriptTemplate(source_filename: str, destination_path: Path | None, aliases: list[str], related_variables: list[str], enabled: Callable[[Guest], bool], context: dict[str, str], _rendered_script_path: Path | None = None)
Bases:
ScriptRepresents a Jinja2 templated script.
The source filename is constructed from the name of the file specified via the
source_filenameattribute, with the.j2suffix appended. The template file must be located in the directory specified viaSCRIPTS_SRC_DIRvariable.- context: dict[str, str]
- tmt.steps.scripts.effective_scripts_dest_dir(default: Path = Path('/usr/local/bin')) Path
Find out what the actual scripts destination directory is.
If the
TMT_SCRIPTS_DIRenvironment variable is set, it is used as the scripts destination directory. Otherwise, thedefaultparameter path is returned.
Module contents
Step Classes
- class tmt.steps.Action(*, order: int = 50, **kwargs: Any)
Bases:
Phase,MultiInvokableCommonA special action performed during a normal step.
Initialize name and relation with the parent object
Prepare the workdir for provided id / directory path or generate a new workdir name if workdir=True given. Store command line context and options for future use if context is provided.
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- cli_invocations: list['tmt.cli.CliInvocation'] = []
- abstractmethod go() None
- class tmt.steps.ActionTask(phase: Action, logger: Logger)
Bases:
GuestlessTask[None]A task to run an action
- property name: str
A name of this task.
Left for child classes to implement, because the name depends on the actual task.
- class tmt.steps.BasePlugin(*, step: Step, data: StepDataT, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
HasRunWorkdir,HasStepWorkdir,HasPlanWorkdir,HasPhaseWorkdir,Phase,Generic[StepDataT,PluginReturnValueT]Common parent of all step plugins
Store plugin name, data and parent step
- abstractmethod classmethod base_command(usage: str, method_class: type[Command] | None = None) Command
Create base click command (common for all step plugins)
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- classmethod command() Command
Prepare click command for all supported methods
- data: StepDataT
- default(option: str, default: Any | None = None) Any
Return default data for given option
- classmethod delegate(step: Step, data: StepDataT | None = None, raw_data: _RawStepData | None = None) BasePlugin[StepDataT, PluginReturnValueT]
Return plugin instance implementing the data[‘how’] method
Supports searching by method prefix as well (e.g. ‘virtual’). The first matching method with the lowest ‘order’ wins.
- property enabled_by_when: bool
Check if the plugin is enabled by ‘when’ keyword
- essential_requires() list[DependencySimple | DependencyFmfId | DependencyFile]
Collect all essential requirements of the plugin.
Essential requirements of a plugin are necessary for the plugin to perform its basic functionality.
- Returns:
a list of requirements.
- get(option: str, default: Any | None = None) Any
Get option from plugin data, user/system config or defaults
- classmethod get_data_class() type[StepDataT]
Return step data class for this plugin.
By default,
_data_classis returned, but plugin may override this method to provide different class.
- classmethod get_step_name() str
- how: str = 'shell'
- classmethod options(how: str | None = None) list[Callable[[Any], Any]]
Prepare command line options for given method
- property phase_workdir: Path
Path to a phase workdir.
- Raises:
GeneralError – when there is no phase workdir yet.
- property plan_workdir: Path
Path to a plan workdir.
- Raises:
GeneralError – when there is no plan workdir yet.
- prune(logger: Logger) None
Prune uninteresting files from the plugin workdir
By default we remove the whole workdir. Individual plugins can override this method to keep files and directories which are useful for inspection when the run is finished.
- property run_workdir: Path
Path to a run workdir.
- Raises:
GeneralError – when there is no current run, or the run does not have a workdir yet.
- property safe_name: str
A safe variant of the name which does not contain special characters.
Override parent implementation as we do not allow phase names to contain slash characters,
/.
- show(keys: list[str] | None = None) None
Show plugin details for given or all available keys
- property step_workdir: Path
Path to a step workdir.
- Raises:
GeneralError – when there is no step workdir yet.
- wake() None
Wake up the plugin, process data, apply options
Check command line options corresponding to plugin keys and store their value into the ‘self.data’ dictionary if their value is True or non-empty.
By default, all supported options corresponding to common and plugin-specific keys are processed. List of key names in the ‘keys’ parameter can be used to override only selected ones.
- tmt.steps.DEFAULT_SOFT_REBOOT_COMMAND = <tmt.utils.ShellScript object>
A default command to trigger a guest reboot when executed remotely.
- class tmt.steps.DefaultNameGenerator(known_names: list[str])
Bases:
objectGenerator of names for that do not have any.
If user did not set any
namefor one or more phases, tmt will assign them a “dummy” namedefault-N. This class wraps the generator.Generator of names for that do not have any.
- Parameters:
known_names – already existing names the generator needs to avoid.
- classmethod from_raw_phases(raw_data: Iterable[_RawStepData]) DefaultNameGenerator
Create a generator based on available phase specifications.
A special constructor that extracts
known_namesfromraw_data.- Parameters:
raw_data – phase specifications as collected from fmf nodes and CLI options.
- get() str
- restart() None
Reset the generator and start from the beginning again
- class tmt.steps.GuestTopology(guest: Guest)
Bases:
SerializableContainerDescribes a guest in the topology of provisioned tmt guests
- hostname: str | None
- name: str
- role: str | None
- class tmt.steps.GuestlessPlugin(*, step: Step, data: StepDataT, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
BasePlugin[StepDataT,PluginReturnValueT]Common parent of all step plugins that do not work against a particular guest
Store plugin name, data and parent step
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- abstractmethod go(*, logger: Logger | None = None) PluginReturnValueT
Perform actions shared among plugins when beginning their tasks
- class tmt.steps.Login(*, step: Step, order: int, logger: Logger)
Bases:
ActionLog into the guest
Initialize relations, store the login order
- after_test(results: list[Result], cwd: Path | None = None, env: Environment | None = None) None
Check and login after test execution
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- cli_invocations: list['tmt.cli.CliInvocation'] = []
- classmethod command(method_class: Method | None = None, usage: str | None = None) Command
Create the login command
- go(force: bool = False) None
Login to the guest(s)
- class tmt.steps.Method(name: str, class_: type[BasePlugin], doc: str | None = None, order: int = 50, installation_hint: str | None = None)
Bases:
objectStep implementation method
Store method data
- describe() str
Format name and summary for a nice method overview
- usage() str
Prepare a detailed usage from summary and description
- tmt.steps.PHASE_ORDER_PREPARE_INSTALL_ESSENTIAL_REQUIRES = 30
Installation of essential plugin and check requirements.
- tmt.steps.PHASE_ORDER_PREPARE_INSTALL_RECOMMENDS = 75
Installation of packages recommended by tests.
- class tmt.steps.Phase(*, order: int = 50, **kwargs: Any)
Bases:
CommonA phase of a step
Initialize name and relation with the parent object
Prepare the workdir for provided id / directory path or generate a new workdir name if workdir=True given. Store command line context and options for future use if context is provided.
- assert_feeling_safe(deprecated_in_version: str, subject: str) None
Raises a tmt.utils.ProvisionError if feeling-safe is required, but not set. Warns when feeling-safe will be required in a future version. :param deprecated_in_version: Version from which feeling-safe is required, e.g. ‘1.38’. :param subject: Subject requiring feeling-safe, e.g. ‘Local provision plugin’.
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- property enabled_by_when: bool
- property is_in_standalone_mode: bool
True if the phase is in stand-alone mode.
Stand-alone mode means that only this phase should be run as a part of the run (and not any other even if requested using –all). This is useful as some plugin options may completely change its behaviour from the regular behaviour based on options (e.g. listing images inside a provision plugin).
- class tmt.steps.PhaseQueue(name: str, logger: Logger)
Bases:
Queue[ActionTask|PluginTask[StepDataT,PluginReturnValueT]]Queue class for running phases on guests
- enqueue_plugin(*, phase: Plugin[StepDataT, PluginReturnValueT], guests: list[Guest]) None
- class tmt.steps.Plugin(*, step: Step, data: StepDataT, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
BasePlugin[StepDataT,PluginReturnValueT]Common parent of all step plugins that do work against a particular guest
Store plugin name, data and parent step
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- abstractmethod go(*, guest: Guest, environment: Environment | None = None, logger: Logger) PluginReturnValueT
Perform actions shared among plugins when beginning their tasks
- write_command_report(*, path: Path, label: str, timer: Stopwatch, command: Command | ShellScript | None = None, output: CommandOutput, exc: None = None) None
- write_command_report(*, path: Path, label: str, timer: Stopwatch, command: Command | ShellScript | None = None, output: None = None, exc: Exception) None
Create a report for a given command outcome.
Combines
tmt.utils.render_report()andtmt.utils.render_command_report()to create a report for a given command, its output, and possibly its failure. The report is then appended to the given file.Note
This method is focusing on reporting of command outcomes. It provides standardized header, fields, and formatting. For reports consisting of other topics see
tmt.utils.render_report()andwrite_report().Note
This method is designed for reporting an action of a single command. If you need to report an action consisting of multiple commands, build the body of the report by calling
tmt.utils.render_command_report()for individual commands, and usewrite_report()to finish the report.body: list[str] = [] for command in commands: body.extend(render_command_report(...)) self.write_report(..., body=body)
- Parameters:
path – the report file to write into.
label – see
tmt.utils.render_report().timer – see
tmt.utils.render_report().command – see
tmt.utils.render_command_report().output – see
tmt.utils.render_command_report().exc – see
tmt.utils.render_command_report().
- write_report(*, path: Path, label: str, timer: Stopwatch, body: Iterable[str] | None = None) None
Format and write an arbitrary body of text into a report file.
Uses
tmt.utils.render_report()to create a report with a given content. The report is then appended to the given file.Note
This method is focusing on reporting of arbitrary actions. It provides standardized header, fields, and formatting. For reports of command outcomes see
tmt.utils.render_command_report()andwrite_command_report().- Parameters:
path – the report file to write into.
label – see
tmt.utils.render_report().timer – see
tmt.utils.render_report().body – see
tmt.utils.render_report().
- class tmt.steps.PluginOutcome(results: list[PhaseResult] = <factory>, exceptions: list[Exception] = <factory>)
Bases:
objectBundles together results produced by a plugin, and possible error.
- exceptions: list[Exception]
Exceptions the plugin would like to raise and report.
- results: list[PhaseResult]
Results produced by the plugin invocation.
- class tmt.steps.PluginReturnValueT
A type variable representing a return value of plugin’s
go()method.alias of TypeVar(‘PluginReturnValueT’)
- class tmt.steps.PluginTask(phase: Plugin[StepDataT, PluginReturnValueT], guests: list[Guest], logger: Logger)
Bases:
MultiGuestTask[PluginReturnValueT],Generic[StepDataT,PluginReturnValueT]A task to run a phase on a given set of guests
- property name: str
A name of this task.
Left for child classes to implement, because the name depends on the actual task.
- phase: Plugin[StepDataT, PluginReturnValueT]
- property phase_name: str
- run_on_guest(guest: Guest, logger: Logger) PluginReturnValueT
Perform the task.
Called once from
go(). Subclasses of must implement their logic in this method rather than ingo()which is already provided.
- class tmt.steps.PullTask(guests: list[Guest], source: Path | None, logger: Logger)
Bases:
MultiGuestTask[None]Task performing a workdir pull from a guest
- property name: str
A name of this task.
Left for child classes to implement, because the name depends on the actual task.
- run_on_guest(guest: Guest, logger: Logger) None
Perform the task.
Called once from
go(). Subclasses of must implement their logic in this method rather than ingo()which is already provided.
- source: Path | None
- class tmt.steps.PushTask(guests: list[Guest], logger: Logger)
Bases:
MultiGuestTask[None]Task performing a workdir push to a guest
- property name: str
A name of this task.
Left for child classes to implement, because the name depends on the actual task.
- class tmt.steps.Reboot(*, step: Step, order: int, logger: Logger)
Bases:
ActionReboot guest
Initialize relations, store the reboot order
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- cli_invocations: list['tmt.cli.CliInvocation'] = []
- classmethod command(method_class: Method | None = None, usage: str | None = None) Command
Create the reboot command
- go() None
Reboot the guest(s)
- class tmt.steps.ResultT
A type variable representing a result type.
alias of TypeVar(‘ResultT’, bound=
BaseResult)
- class tmt.steps.Step(*, plan: Plan, data: _RawStepData | list[_RawStepData] | None = None, name: str | None = None, workdir: Literal[True] | Path | None = None, logger: Logger)
Bases:
HasRunWorkdir,HasStepWorkdir,HasPlanWorkdir,MultiInvokableCommon,Exportable[Step]Common parent of all test steps
Initialize and check the step data
- DEFAULT_HOW: str = 'shell'
- actions() None
Run all loaded Login or Reboot action instances of the step
- add_phase(phase: Phase) None
Add a phase dynamically to the current step.
- Parameters:
phase – The phase to add.
- property allowed_methods_pattern: Pattern[str]
Return a pattern allowed methods must match
- cli_invocation: 'tmt.cli.CliInvocation' | None = None
- cli_invocations: list['tmt.cli.CliInvocation'] = []
- property enabled: bool | None
True if the step is enabled
- go(force: bool = False) None
Execute the test step
- load() None
Load status and step data from the workdir
- phases(classes: None = None) list[Phase]
- phases(classes: type[PhaseT]) list[PhaseT]
- phases(classes: tuple[type[PhaseT], ...]) list[PhaseT]
Iterate over phases by their order
By default iterates over all available phases. Optional filter ‘classes’ can be used to iterate only over instances of given class (single class or tuple of classes).
- property plan_workdir: Path
Path to a plan workdir.
- Raises:
GeneralError – when there is no plan workdir yet.
- property plugins_in_standalone_mode: int
The number of plugins in standalone mode.
Stand-alone mode means that only this step should be run as a part of the run (and not any other even if requested using –all). This is useful as some step options may completely change its behaviour from the regular behaviour based on options (e.g. listing images inside provision).
- property run_workdir: Path
Path to a run workdir.
- Raises:
GeneralError – when there is no current run, or the run does not have a workdir yet.
- save() None
Save status and step data to the workdir
- setup_actions() None
Insert login and reboot plugins if requested
- show() None
Show step details
- status(status: str | None = None) str | None
Get and set current step status
The meaning of the status is as follows: todo … config, data and command line processed (we know what to do) done … the final result of the step stored to workdir (we are done)
- property step_name: str
- property step_workdir: Path
Path to a step workdir.
- Raises:
GeneralError – when there is no step workdir yet.
- abstractmethod summary() None
Give a concise summary about the step result
To be implemented by each step.
- suspend() None
Suspend the step.
Perform any actions necessary before quitting the step and tmt. The step may be revisited by future tmt invocations.
- classmethod usage(method_overview: str) str
Prepare general usage message for the step
- wake() None
Wake up the step (process workdir and command line)
- class tmt.steps.StepData(name: str, how: str, order: int = 50, when: list[str] = <factory>, summary: str | None = None)
Bases:
SpecBasedContainer[_RawStepData,_RawStepData],NormalizeKeysMixin,SerializableContainerKeys necessary to describe, create, save and restore a step.
Very basic set of keys shared across all steps.
Provides basic functionality for transition between “raw” step data, which consists of fmf nodes and CLI options, and this container representation with keys and types more suitable for internal use.
Implementation expects simple 1:1 relation between
StepDataattributes - keys - and their fmf/CLI sources, where keys replace options’ dashes (-) with underscores (_). For example, to hold value of an fmf keyfoo-bar- or value of a corresponding CLI option,--foo-bar, a step data class should declare key namedfoo_data. AllStepDatamethods would honor this mapping.- classmethod from_spec(raw_data: _RawStepData, logger: Logger) Self
Convert from a specification file or from a CLI option
- how: str
- name: str
- order: int = 50
- post_normalization(raw_data: _RawStepData, logger: Logger) None
Called after normalization, useful for tweaking normalized data
- classmethod pre_normalization(raw_data: _RawStepData, logger: Logger) None
Called before normalization, useful for tweaking raw data
- summary: str | None = None
- to_spec() _RawStepData
Convert to a form suitable for saving in a specification file
- when: list[str]
- class tmt.steps.Topology(guests: list[Guest])
Bases:
SerializableContainerDescribes the topology of provisioned tmt guests
- guest: GuestTopology | None
- guest_names: list[str]
- guests: dict[str, GuestTopology]
- push(*, dirpath: Path, guest: Guest, filename_base: Path | None = None, logger: Logger) Environment
Save and push topology to a given guest
- role_names: list[str]
- roles: dict[str, list[str]]
- save(*, dirpath: Path, filename_base: Path | None = None) list[Path]
Save the topology in files.
- Parameters:
dirpath – a directory to save into.
filename_base – if set, it would be used as a base for filenames, correct suffixes would be added.
- Returns:
list of paths to saved files.
- save_bash(dirpath: Path, filename: Path | None = None) Path
Save the topology in a Bash-sourceable file.
- Parameters:
dirpath – a directory to save into.
filename – if set, it would be used, otherwise a filename is created from
TEST_TOPOLOGY_FILENAME_BASEand.shsuffix.
- Returns:
path to the saved file.
- save_yaml(dirpath: Path, filename: Path | None = None) Path
Save the topology in a YAML file.
- Parameters:
dirpath – a directory to save into.
filename – if set, it would be used, otherwise a filename is created from
TEST_TOPOLOGY_FILENAME_BASEand.yamlsuffix.
- Returns:
path to the saved file.
- to_dict() dict[str, Any]
Convert to a mapping.
See https://tmt.readthedocs.io/en/stable/code/classes.html#class-conversions for more details.
- class tmt.steps.WhereableStepData(where: list[str] = <factory>)
Bases:
objectKeys shared by step data that may be limited to a particular guest.
To be used as a mixin class, adds necessary keys.
See [1] and [2] for specification.
- where: list[str]
- tmt.steps.is_action_name(val: str) TypeGuard[Literal['login', 'reboot']]
- tmt.steps.is_step_name(val: str) TypeGuard[Literal['discover', 'provision', 'prepare', 'execute', 'report', 'finish', 'cleanup']]
- tmt.steps.provides_method(name: str, doc: str | None = None, order: int = 50, installation_hint: str | None = None) Callable[[type[BasePlugin]], type[BasePlugin]]
A plugin class decorator to register plugin’s method with tmt steps.
In the following example, developer marks
SomePluginas providing two discover methods,fooandbar, withbarbeing sorted to later position among methods:@tmt.steps.provides_method('foo') @tmt.steps.provides_method('bar', order=80) class SomePlugin(tmt.steps.discover.DicoverPlugin): ...
- Parameters:
name – name of the method.
doc – method documentation. If not specified, docstring of the decorated class is used.
order – order of the method among other step methods.
- tmt.steps.prune_directory(path: Path, preserved_members: set[str], logger: Logger) set[str]
Remove content of a given directory while preserving selected members.
- Parameters:
path – a directory to prune.
preserved_members – names of directory entries that should not be removed.
logger – used for logging.
- Returns:
names of members that were actually preserved, i.e. members that exist in the directory, and were not removed.
- tmt.steps.safe_filename(template: str, phase: Phase, guest: Guest, **variables: Any) Path
Construct a non-conflicting filename safe for parallel tasks.
Function adds enough uniqueness to a given template by adding a phase name and a guest name that the eventual filename would be safe against conflicting access from a phase running on multiple guests, and against reuse when created by the same plugin in different phases.
At first glance, the name might be an overkill: at one moment, there is just one phase running on the given guest, why bother? No other phase would touch the file on the guest. But:
filenames are created locally. One phase, running against multiple guests, still needs the filename to be unique on the tmt runner. Otherwise, phase running in different threads would contest a single file.
while the scenario is unlikely, user may eventually convince tmt to recognize two different names for the same machine, via
-h connect --guest $IP. Therefore it may happen that one phase, running against two guests, would actually run on the very same HW. Therefore even the remote per-guest uniqueness is needed.the phase name is included to avoid reuse of the filename by different phases. A plugin may be invoked by multiple phases, and it might use a “constant” name for the file. That would lead to the filename being reused by different plugin executions. Adding the phase name should lower confusion: it would be immediately clear which phase used which filename, or whether a filename was or was not created by given phase.
- Parameters:
template – filename template. It is enhanced with
phaseandguestsafe name, but may use other variables provided invariables.phase – a phase owning the resulting filename.
guest – a guest on which the filename would be used.
variables – additional variables
templateneed when rendering the filename.
- tmt.steps.sync_with_guests(step: Step, action: str, task: GuestSyncTaskT, logger: Logger) None
Push and pull stuff from guests in a parallel manner.
Used by steps that run their plugins against one or more guest. Based on a
PhaseQueueprimitive, parallelized push/pull operations are needed, and this function handles the details.