From 08e24751ff64731684658b400ff1876df62260d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Gajdu=C5=A1ek?= Date: Fri, 3 May 2024 15:22:25 +0200 Subject: [PATCH] Lint: Black -> Ruff formatter (#14896) --- .pre-commit-config.yaml | 7 +--- conftest.py | 1 + docs/conf.py | 1 + pyproject.toml | 24 ++++------- pytest_fixtures/component/virtwho_config.py | 6 +-- pytest_fixtures/core/contenthosts.py | 1 + pytest_fixtures/core/xdist.py | 5 +-- pytest_plugins/capsule_n-minus.py | 1 - pytest_plugins/requirements/req_updater.py | 1 - .../requirements/update_requirements.py | 1 + pytest_plugins/sanity_plugin.py | 2 +- robottelo/cli/acs.py | 1 + robottelo/cli/activationkey.py | 1 + robottelo/cli/admin.py | 1 + robottelo/cli/ansible.py | 1 + robottelo/cli/architecture.py | 1 + robottelo/cli/arfreport.py | 1 + robottelo/cli/auth.py | 1 + robottelo/cli/base.py | 1 + robottelo/cli/bootdisk.py | 1 + robottelo/cli/capsule.py | 1 + robottelo/cli/computeprofile.py | 1 + robottelo/cli/computeresource.py | 1 + robottelo/cli/content_credentials.py | 1 + robottelo/cli/content_export.py | 1 + robottelo/cli/content_import.py | 1 + robottelo/cli/contentview.py | 1 + robottelo/cli/defaults.py | 1 + robottelo/cli/discoveredhost.py | 1 + robottelo/cli/discoveryrule.py | 1 + robottelo/cli/docker.py | 1 + robottelo/cli/domain.py | 1 + robottelo/cli/environment.py | 1 + robottelo/cli/erratum.py | 1 + robottelo/cli/fact.py | 1 + robottelo/cli/file.py | 1 + robottelo/cli/filter.py | 1 + robottelo/cli/globalparam.py | 1 + robottelo/cli/gpgkey.py | 1 + robottelo/cli/hammer.py | 1 + robottelo/cli/host.py | 1 + robottelo/cli/host_registration.py | 1 + robottelo/cli/hostcollection.py | 1 + robottelo/cli/hostgroup.py | 1 + robottelo/cli/http_proxy.py | 1 + robottelo/cli/job_invocation.py | 1 + robottelo/cli/job_template.py | 1 + robottelo/cli/ldapauthsource.py | 1 + robottelo/cli/lifecycleenvironment.py | 1 + robottelo/cli/location.py | 1 + robottelo/cli/medium.py | 1 + robottelo/cli/model.py | 1 + robottelo/cli/module_stream.py | 1 + robottelo/cli/operatingsys.py | 1 + robottelo/cli/org.py | 1 + robottelo/cli/ostreebranch.py | 1 + robottelo/cli/package.py | 1 + robottelo/cli/partitiontable.py | 1 + robottelo/cli/product.py | 1 + robottelo/cli/proxy.py | 1 + robottelo/cli/puppet.py | 1 + robottelo/cli/realm.py | 1 + robottelo/cli/recurring_logic.py | 1 + robottelo/cli/report.py | 1 + robottelo/cli/report_template.py | 1 + robottelo/cli/repository.py | 1 + robottelo/cli/repository_set.py | 1 + robottelo/cli/role.py | 1 + robottelo/cli/scap_policy.py | 1 + robottelo/cli/scap_tailoring_files.py | 1 + robottelo/cli/scapcontent.py | 1 + robottelo/cli/scparams.py | 1 + robottelo/cli/settings.py | 1 + robottelo/cli/simple_content_access.py | 1 + robottelo/cli/sm_advanced.py | 1 + robottelo/cli/sm_advanced_by_tag.py | 1 + robottelo/cli/sm_backup.py | 1 + robottelo/cli/sm_health.py | 1 + robottelo/cli/sm_maintenance_mode.py | 1 + robottelo/cli/sm_packages.py | 1 + robottelo/cli/sm_restore.py | 1 + robottelo/cli/sm_service.py | 1 + robottelo/cli/sm_upgrade.py | 1 + robottelo/cli/srpm.py | 1 + robottelo/cli/subnet.py | 1 + robottelo/cli/subscription.py | 1 + robottelo/cli/syncplan.py | 1 + robottelo/cli/task.py | 1 + robottelo/cli/template.py | 1 + robottelo/cli/template_input.py | 1 + robottelo/cli/template_sync.py | 1 + robottelo/cli/user.py | 1 + robottelo/cli/usergroup.py | 1 + robottelo/cli/virt_who_config.py | 1 + robottelo/cli/webhook.py | 2 +- robottelo/constants/__init__.py | 1 + robottelo/content_info.py | 1 + robottelo/host_helpers/api_factory.py | 1 + robottelo/host_helpers/cli_factory.py | 1 + robottelo/host_helpers/contenthost_mixins.py | 1 + robottelo/host_helpers/repository_mixins.py | 2 +- robottelo/host_helpers/satellite_mixins.py | 2 +- robottelo/host_helpers/ui_factory.py | 1 + robottelo/hosts.py | 7 +--- robottelo/ssh.py | 1 + robottelo/utils/datafactory.py | 1 + robottelo/utils/decorators/__init__.py | 1 + robottelo/utils/decorators/func_locker.py | 2 +- .../decorators/func_shared/file_storage.py | 1 - .../decorators/func_shared/redis_storage.py | 1 - .../utils/decorators/func_shared/shared.py | 9 +--- robottelo/utils/manifest.py | 6 +-- robottelo/utils/ohsnap.py | 1 + robottelo/utils/shared_resource.py | 1 + robottelo/utils/ssh.py | 1 + robottelo/utils/vault.py | 1 + robottelo/utils/virtwho.py | 1 + scripts/config_helpers.py | 1 + scripts/graph_entities.py | 1 + scripts/hammer_command_tree.py | 1 + scripts/token_editor.py | 3 +- scripts/tokenize_customer_scenario.py | 1 + scripts/validate_config.py | 1 + tests/foreman/api/test_acs.py | 1 + tests/foreman/api/test_activationkey.py | 1 + tests/foreman/api/test_ansible.py | 1 + tests/foreman/api/test_architecture.py | 1 + tests/foreman/api/test_audit.py | 1 + tests/foreman/api/test_bookmarks.py | 1 + tests/foreman/api/test_capsule.py | 1 + tests/foreman/api/test_capsulecontent.py | 1 + tests/foreman/api/test_classparameters.py | 1 + tests/foreman/api/test_computeprofile.py | 1 + .../api/test_computeresource_azurerm.py | 1 + tests/foreman/api/test_computeresource_gce.py | 1 + .../api/test_computeresource_libvirt.py | 1 + tests/foreman/api/test_contentcredentials.py | 1 + tests/foreman/api/test_contentview.py | 1 + tests/foreman/api/test_contentviewfilter.py | 1 + tests/foreman/api/test_contentviewversion.py | 1 + tests/foreman/api/test_convert2rhel.py | 1 + tests/foreman/api/test_discoveredhost.py | 1 + tests/foreman/api/test_discoveryrule.py | 1 + tests/foreman/api/test_docker.py | 1 + tests/foreman/api/test_environment.py | 1 + tests/foreman/api/test_errata.py | 9 ++-- tests/foreman/api/test_foremantask.py | 1 + tests/foreman/api/test_host.py | 1 + tests/foreman/api/test_hostcollection.py | 1 + tests/foreman/api/test_hostgroup.py | 1 + tests/foreman/api/test_http_proxy.py | 1 + tests/foreman/api/test_ldapauthsource.py | 1 + .../foreman/api/test_lifecycleenvironment.py | 1 + tests/foreman/api/test_location.py | 1 + tests/foreman/api/test_media.py | 3 +- tests/foreman/api/test_multiple_paths.py | 1 + tests/foreman/api/test_operatingsystem.py | 1 + tests/foreman/api/test_organization.py | 1 + .../foreman/api/test_oscap_tailoringfiles.py | 1 + tests/foreman/api/test_oscappolicy.py | 1 + tests/foreman/api/test_parameters.py | 1 + tests/foreman/api/test_partitiontable.py | 1 + tests/foreman/api/test_permission.py | 1 + tests/foreman/api/test_ping.py | 1 + tests/foreman/api/test_product.py | 1 + tests/foreman/api/test_provisioning.py | 1 + tests/foreman/api/test_provisioning_puppet.py | 1 + .../foreman/api/test_provisioningtemplate.py | 1 + tests/foreman/api/test_registration.py | 1 + tests/foreman/api/test_remoteexecution.py | 1 + tests/foreman/api/test_reporttemplates.py | 1 + tests/foreman/api/test_repositories.py | 1 + tests/foreman/api/test_repository.py | 3 +- tests/foreman/api/test_repository_set.py | 1 + tests/foreman/api/test_rhc.py | 1 + tests/foreman/api/test_rhcloud_inventory.py | 1 + tests/foreman/api/test_rhsm.py | 1 + tests/foreman/api/test_role.py | 3 +- tests/foreman/api/test_settings.py | 1 + tests/foreman/api/test_subnet.py | 1 + tests/foreman/api/test_subscription.py | 1 + tests/foreman/api/test_syncplan.py | 1 + .../foreman/api/test_template_combination.py | 1 + tests/foreman/api/test_templatesync.py | 1 + tests/foreman/api/test_user.py | 3 +- tests/foreman/api/test_usergroup.py | 1 + tests/foreman/api/test_webhook.py | 1 + tests/foreman/cli/test_abrt.py | 1 + tests/foreman/cli/test_acs.py | 1 + tests/foreman/cli/test_activationkey.py | 1 + tests/foreman/cli/test_ansible.py | 1 + tests/foreman/cli/test_architecture.py | 1 + tests/foreman/cli/test_auth.py | 5 +-- tests/foreman/cli/test_bootdisk.py | 1 + tests/foreman/cli/test_bootstrap_script.py | 1 + tests/foreman/cli/test_capsule.py | 1 + tests/foreman/cli/test_classparameters.py | 1 + .../cli/test_computeresource_azurerm.py | 11 +++-- tests/foreman/cli/test_computeresource_ec2.py | 1 + .../cli/test_computeresource_libvirt.py | 1 + tests/foreman/cli/test_computeresource_osp.py | 1 + .../foreman/cli/test_computeresource_rhev.py | 1 + .../cli/test_computeresource_vmware.py | 1 + .../foreman/cli/test_container_management.py | 1 + tests/foreman/cli/test_contentaccess.py | 1 + tests/foreman/cli/test_contentcredentials.py | 1 + tests/foreman/cli/test_contentview.py | 1 + tests/foreman/cli/test_contentviewfilter.py | 1 + tests/foreman/cli/test_discoveredhost.py | 1 + tests/foreman/cli/test_discoveryrule.py | 1 + tests/foreman/cli/test_docker.py | 1 + tests/foreman/cli/test_domain.py | 1 + tests/foreman/cli/test_environment.py | 1 + tests/foreman/cli/test_errata.py | 1 + tests/foreman/cli/test_fact.py | 1 + tests/foreman/cli/test_filter.py | 1 + tests/foreman/cli/test_foremantask.py | 1 + tests/foreman/cli/test_globalparam.py | 1 + tests/foreman/cli/test_hammer.py | 1 + tests/foreman/cli/test_host.py | 1 + tests/foreman/cli/test_hostcollection.py | 1 + tests/foreman/cli/test_hostgroup.py | 1 + tests/foreman/cli/test_http_proxy.py | 1 + tests/foreman/cli/test_installer.py | 1 + tests/foreman/cli/test_jobtemplate.py | 1 + tests/foreman/cli/test_ldapauthsource.py | 3 +- tests/foreman/cli/test_leapp_client.py | 1 + .../foreman/cli/test_lifecycleenvironment.py | 1 + tests/foreman/cli/test_location.py | 1 + tests/foreman/cli/test_logging.py | 3 +- tests/foreman/cli/test_medium.py | 1 + tests/foreman/cli/test_model.py | 3 +- tests/foreman/cli/test_operatingsystem.py | 1 + tests/foreman/cli/test_organization.py | 1 + tests/foreman/cli/test_oscap.py | 1 + .../foreman/cli/test_oscap_tailoringfiles.py | 2 +- tests/foreman/cli/test_ostreebranch.py | 1 + tests/foreman/cli/test_partitiontable.py | 1 + tests/foreman/cli/test_ping.py | 1 + tests/foreman/cli/test_product.py | 1 + tests/foreman/cli/test_provisioning.py | 1 + .../foreman/cli/test_provisioningtemplate.py | 1 + tests/foreman/cli/test_puppetclass.py | 1 + tests/foreman/cli/test_realm.py | 1 + tests/foreman/cli/test_registration.py | 1 + tests/foreman/cli/test_remoteexecution.py | 1 + tests/foreman/cli/test_report.py | 1 + tests/foreman/cli/test_reporttemplates.py | 1 + tests/foreman/cli/test_repositories.py | 1 + tests/foreman/cli/test_repository.py | 1 + tests/foreman/cli/test_repository_set.py | 1 + tests/foreman/cli/test_rhcloud_inventory.py | 1 + tests/foreman/cli/test_role.py | 1 + tests/foreman/cli/test_satellitesync.py | 1 + tests/foreman/cli/test_settings.py | 1 + tests/foreman/cli/test_sso.py | 1 + tests/foreman/cli/test_subnet.py | 1 + tests/foreman/cli/test_subscription.py | 1 + tests/foreman/cli/test_syncplan.py | 1 + tests/foreman/cli/test_templatesync.py | 1 + tests/foreman/cli/test_user.py | 1 + tests/foreman/cli/test_usergroup.py | 1 + .../cli/test_vm_install_products_package.py | 1 + tests/foreman/cli/test_webhook.py | 1 + tests/foreman/destructive/test_ansible.py | 1 + tests/foreman/destructive/test_auth.py | 1 + tests/foreman/destructive/test_capsule.py | 1 + .../destructive/test_capsule_loadbalancer.py | 1 + .../destructive/test_capsulecontent.py | 1 + tests/foreman/destructive/test_clone.py | 1 + tests/foreman/destructive/test_contenthost.py | 1 + tests/foreman/destructive/test_contentview.py | 1 + .../destructive/test_discoveredhost.py | 1 + .../foreman/destructive/test_foreman_rake.py | 1 + .../destructive/test_foreman_service.py | 1 + tests/foreman/destructive/test_host.py | 1 + tests/foreman/destructive/test_infoblox.py | 1 + tests/foreman/destructive/test_installer.py | 1 + .../foreman/destructive/test_katello_agent.py | 1 + .../destructive/test_katello_certs_check.py | 1 + .../destructive/test_ldap_authentication.py | 10 +++-- .../destructive/test_ldapauthsource.py | 1 + .../destructive/test_leapp_satellite.py | 1 + tests/foreman/destructive/test_packages.py | 1 + tests/foreman/destructive/test_ping.py | 1 + .../foreman/destructive/test_puppetplugin.py | 1 + tests/foreman/destructive/test_realm.py | 1 + .../foreman/destructive/test_registration.py | 1 + .../destructive/test_remoteexecution.py | 1 + tests/foreman/destructive/test_rename.py | 1 + tests/foreman/destructive/test_repository.py | 1 + tests/foreman/endtoend/test_api_endtoend.py | 1 + tests/foreman/endtoend/test_cli_endtoend.py | 1 + tests/foreman/installer/test_infoblox.py | 1 + tests/foreman/installer/test_installer.py | 1 + tests/foreman/longrun/test_inc_updates.py | 1 + tests/foreman/longrun/test_oscap.py | 1 + tests/foreman/maintain/test_advanced.py | 1 + tests/foreman/maintain/test_backup_restore.py | 17 ++++---- tests/foreman/maintain/test_health.py | 1 + .../foreman/maintain/test_maintenance_mode.py | 1 + tests/foreman/maintain/test_offload_DB.py | 1 + tests/foreman/maintain/test_packages.py | 1 + tests/foreman/maintain/test_service.py | 1 + tests/foreman/maintain/test_upgrade.py | 1 + tests/foreman/sanity/test_bvt.py | 1 + tests/foreman/sys/test_dynflow.py | 1 + tests/foreman/sys/test_fam.py | 1 + tests/foreman/sys/test_katello_certs_check.py | 1 + tests/foreman/sys/test_pulp3_filesystem.py | 1 + tests/foreman/ui/test_activationkey.py | 1 + tests/foreman/ui/test_ansible.py | 3 +- tests/foreman/ui/test_architecture.py | 1 + tests/foreman/ui/test_audit.py | 1 + tests/foreman/ui/test_bookmarks.py | 1 + tests/foreman/ui/test_branding.py | 1 + tests/foreman/ui/test_computeprofiles.py | 13 +++--- tests/foreman/ui/test_computeresource.py | 2 +- .../ui/test_computeresource_azurerm.py | 1 + tests/foreman/ui/test_computeresource_ec2.py | 1 + tests/foreman/ui/test_computeresource_gce.py | 1 + .../ui/test_computeresource_libvirt.py | 1 + .../foreman/ui/test_computeresource_vmware.py | 1 + tests/foreman/ui/test_config_group.py | 1 + tests/foreman/ui/test_containerimagetag.py | 1 + tests/foreman/ui/test_contentcredentials.py | 1 + tests/foreman/ui/test_contenthost.py | 7 ++-- tests/foreman/ui/test_contentview.py | 1 + tests/foreman/ui/test_dashboard.py | 11 ++--- tests/foreman/ui/test_discoveredhost.py | 1 + tests/foreman/ui/test_discoveryrule.py | 1 + tests/foreman/ui/test_domain.py | 1 + tests/foreman/ui/test_hardwaremodel.py | 1 + tests/foreman/ui/test_host.py | 1 + tests/foreman/ui/test_hostcollection.py | 1 + tests/foreman/ui/test_hostgroup.py | 1 + tests/foreman/ui/test_http_proxy.py | 1 + tests/foreman/ui/test_jobinvocation.py | 1 + tests/foreman/ui/test_jobtemplate.py | 1 + tests/foreman/ui/test_ldap_authentication.py | 41 ++++++++++++------- tests/foreman/ui/test_lifecycleenvironment.py | 1 + tests/foreman/ui/test_location.py | 1 + tests/foreman/ui/test_media.py | 1 + tests/foreman/ui/test_modulestreams.py | 1 + tests/foreman/ui/test_operatingsystem.py | 1 + tests/foreman/ui/test_organization.py | 1 + tests/foreman/ui/test_oscapcontent.py | 1 + tests/foreman/ui/test_oscappolicy.py | 1 + tests/foreman/ui/test_oscaptailoringfile.py | 1 + tests/foreman/ui/test_package.py | 1 + tests/foreman/ui/test_partitiontable.py | 1 + tests/foreman/ui/test_product.py | 1 + tests/foreman/ui/test_provisioningtemplate.py | 1 + tests/foreman/ui/test_puppetclass.py | 1 + tests/foreman/ui/test_puppetenvironment.py | 1 + tests/foreman/ui/test_registration.py | 2 +- tests/foreman/ui/test_remoteexecution.py | 1 + tests/foreman/ui/test_reporttemplates.py | 1 + tests/foreman/ui/test_repositories.py | 1 + tests/foreman/ui/test_repository.py | 1 + tests/foreman/ui/test_rhc.py | 1 + tests/foreman/ui/test_rhcloud_insights.py | 1 + tests/foreman/ui/test_rhcloud_inventory.py | 1 + tests/foreman/ui/test_role.py | 1 + tests/foreman/ui/test_settings.py | 1 + tests/foreman/ui/test_smartclassparameter.py | 1 + tests/foreman/ui/test_subnet.py | 1 + tests/foreman/ui/test_subscription.py | 1 + tests/foreman/ui/test_sync.py | 1 + tests/foreman/ui/test_syncplan.py | 1 + tests/foreman/ui/test_templatesync.py | 1 + tests/foreman/ui/test_user.py | 1 + tests/foreman/ui/test_usergroup.py | 1 + tests/foreman/ui/test_webhook.py | 1 + tests/foreman/virtwho/api/test_esx.py | 5 +-- tests/foreman/virtwho/api/test_esx_sca.py | 5 +-- tests/foreman/virtwho/api/test_hyperv.py | 1 + tests/foreman/virtwho/api/test_hyperv_sca.py | 1 + tests/foreman/virtwho/api/test_kubevirt.py | 1 + .../foreman/virtwho/api/test_kubevirt_sca.py | 1 + tests/foreman/virtwho/api/test_libvirt.py | 1 + tests/foreman/virtwho/api/test_libvirt_sca.py | 1 + tests/foreman/virtwho/api/test_nutanix.py | 1 + tests/foreman/virtwho/api/test_nutanix_sca.py | 1 + tests/foreman/virtwho/cli/test_esx.py | 5 +-- tests/foreman/virtwho/cli/test_esx_sca.py | 5 +-- tests/foreman/virtwho/cli/test_hyperv.py | 1 + tests/foreman/virtwho/cli/test_hyperv_sca.py | 1 + tests/foreman/virtwho/cli/test_kubevirt.py | 1 + .../foreman/virtwho/cli/test_kubevirt_sca.py | 1 + tests/foreman/virtwho/cli/test_libvirt.py | 1 + tests/foreman/virtwho/cli/test_libvirt_sca.py | 1 + tests/foreman/virtwho/cli/test_nutanix.py | 1 + tests/foreman/virtwho/cli/test_nutanix_sca.py | 1 + tests/foreman/virtwho/ui/test_esx.py | 5 +-- tests/foreman/virtwho/ui/test_esx_sca.py | 5 +-- tests/foreman/virtwho/ui/test_hyperv.py | 1 + tests/foreman/virtwho/ui/test_hyperv_sca.py | 1 + tests/foreman/virtwho/ui/test_kubevirt.py | 1 + tests/foreman/virtwho/ui/test_kubevirt_sca.py | 1 + tests/foreman/virtwho/ui/test_libvirt.py | 1 + tests/foreman/virtwho/ui/test_libvirt_sca.py | 1 + tests/foreman/virtwho/ui/test_nutanix.py | 1 + tests/foreman/virtwho/ui/test_nutanix_sca.py | 1 + tests/robottelo/test_datafactory.py | 1 + tests/robottelo/test_decorators.py | 1 + tests/robottelo/test_dependencies.py | 1 + tests/robottelo/test_func_locker.py | 40 ++++++++++-------- tests/robottelo/test_hammer.py | 1 + tests/robottelo/test_helpers.py | 1 + tests/robottelo/test_issue_handlers.py | 7 +++- tests/robottelo/test_ssh.py | 1 + tests/upgrades/conftest.py | 1 + tests/upgrades/test_activation_key.py | 1 + tests/upgrades/test_bookmarks.py | 1 + tests/upgrades/test_capsule.py | 1 + tests/upgrades/test_classparameter.py | 1 + tests/upgrades/test_client.py | 1 + tests/upgrades/test_contentview.py | 1 + tests/upgrades/test_discovery.py | 1 + tests/upgrades/test_errata.py | 1 + tests/upgrades/test_host.py | 1 + tests/upgrades/test_hostcontent.py | 1 + tests/upgrades/test_hostgroup.py | 1 + tests/upgrades/test_performance_tuning.py | 1 + tests/upgrades/test_provisioningtemplate.py | 1 + tests/upgrades/test_puppet.py | 1 + tests/upgrades/test_remoteexecution.py | 1 + tests/upgrades/test_repository.py | 1 + tests/upgrades/test_role.py | 1 + tests/upgrades/test_satellite_maintain.py | 1 + tests/upgrades/test_satellitesync.py | 1 + tests/upgrades/test_subnet.py | 1 + tests/upgrades/test_subscription.py | 1 + tests/upgrades/test_syncplan.py | 1 + tests/upgrades/test_user.py | 1 + tests/upgrades/test_usergroup.py | 1 + tests/upgrades/test_virtwho.py | 3 +- 438 files changed, 552 insertions(+), 155 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c93c0b50203..dd6543a0af9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,15 +11,12 @@ repos: exclude: tests/foreman/data/ - id: check-yaml - id: debug-statements - - repo: https://github.com/psf/black - rev: 22.10.0 - hooks: - - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.0 + rev: v0.4.1 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] + - id: ruff-format - repo: local hooks: - id: fix-uuids diff --git a/conftest.py b/conftest.py index f54b9cce479..c81b56a0c93 100644 --- a/conftest.py +++ b/conftest.py @@ -1,4 +1,5 @@ """Global Configurations for py.test runner""" + import pytest pytest_plugins = [ diff --git a/docs/conf.py b/docs/conf.py index b143f7ac6fe..02ef4d4298a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -4,6 +4,7 @@ http://sphinx-doc.org/config.html """ + import builtins import os import sys diff --git a/pyproject.toml b/pyproject.toml index 71e77065d06..ff201b018ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,22 +1,12 @@ -[tool.black] -line-length = 100 -skip-string-normalization = true -include = '\.pyi?$' -exclude = ''' -/( - \.git - | \.hg - | \.mypy_cache - | \.venv - | _build - | buck-out - | build - | dist -)/ -''' - [tool.ruff] target-version = "py311" +# Allow lines to be as long as 100. +line-length = 100 +exclude = [".git", ".hg", ".mypy_cache", ".venv", "_build", "buck-out", "build", "dist"] + +[tool.ruff.format] +# Preserve quotes +quote-style = "preserve" # TODO: change to "single" when flake8-quotes is enabled [tool.ruff.lint] fixable = ["ALL"] diff --git a/pytest_fixtures/component/virtwho_config.py b/pytest_fixtures/component/virtwho_config.py index b8970232136..d46b1153490 100644 --- a/pytest_fixtures/component/virtwho_config.py +++ b/pytest_fixtures/component/virtwho_config.py @@ -24,11 +24,7 @@ def org_module(request, default_org, module_sca_manifest_org): @pytest.fixture def org_session(request, session, session_sca): - if 'sca' in request.module.__name__.split('.')[-1]: - org_session = session_sca - else: - org_session = session - return org_session + return session_sca if 'sca' in request.module.__name__.split('.')[-1] else session @pytest.fixture diff --git a/pytest_fixtures/core/contenthosts.py b/pytest_fixtures/core/contenthosts.py index b1179c5091b..5f685cdc82c 100644 --- a/pytest_fixtures/core/contenthosts.py +++ b/pytest_fixtures/core/contenthosts.py @@ -4,6 +4,7 @@ The functions in this module are read in the pytest_plugins/fixture_markers.py module All functions in this module will be treated as fixtures that apply the contenthost mark """ + from broker import Broker import pytest diff --git a/pytest_fixtures/core/xdist.py b/pytest_fixtures/core/xdist.py index 2495e4fa1c2..855cd2b1cfd 100644 --- a/pytest_fixtures/core/xdist.py +++ b/pytest_fixtures/core/xdist.py @@ -25,10 +25,7 @@ def align_to_satellite(request, worker_id, satellite_factory): settings.set("server.hostname", None) on_demand_sat = None - if worker_id in ['master', 'local']: - worker_pos = 0 - else: - worker_pos = int(worker_id.replace('gw', '')) + worker_pos = 0 if worker_id in ["master", "local"] else int(worker_id.replace("gw", "")) # attempt to add potential satellites from the broker inventory file if settings.server.inventory_filter: diff --git a/pytest_plugins/capsule_n-minus.py b/pytest_plugins/capsule_n-minus.py index f903e239757..9a7edf76b50 100644 --- a/pytest_plugins/capsule_n-minus.py +++ b/pytest_plugins/capsule_n-minus.py @@ -19,7 +19,6 @@ def pytest_addoption(parser): def pytest_collection_modifyitems(items, config): - if not config.getoption('n_minus', False): return diff --git a/pytest_plugins/requirements/req_updater.py b/pytest_plugins/requirements/req_updater.py index 664a9bb92a5..37d1aabc573 100644 --- a/pytest_plugins/requirements/req_updater.py +++ b/pytest_plugins/requirements/req_updater.py @@ -3,7 +3,6 @@ class ReqUpdater: - # Installed package name as key and its counterpart in requirements file as value package_deviates = { 'Betelgeuse': 'betelgeuse', diff --git a/pytest_plugins/requirements/update_requirements.py b/pytest_plugins/requirements/update_requirements.py index e2ad8840185..74494427ce3 100644 --- a/pytest_plugins/requirements/update_requirements.py +++ b/pytest_plugins/requirements/update_requirements.py @@ -1,4 +1,5 @@ """Plugin enables pytest to notify and update the requirements""" + from .req_updater import ReqUpdater updater = ReqUpdater() diff --git a/pytest_plugins/sanity_plugin.py b/pytest_plugins/sanity_plugin.py index 1d93a4b45f3..14d89b87d54 100644 --- a/pytest_plugins/sanity_plugin.py +++ b/pytest_plugins/sanity_plugin.py @@ -1,4 +1,4 @@ -""" A sanity testing plugin to assist in executing robottelo tests as sanity tests smartly +"""A sanity testing plugin to assist in executing robottelo tests as sanity tests smartly 1. Make installer test to run first which should set the hostname and all other tests then should run after that diff --git a/robottelo/cli/acs.py b/robottelo/cli/acs.py index 0368bc8d8d8..f610a5e983a 100644 --- a/robottelo/cli/acs.py +++ b/robottelo/cli/acs.py @@ -21,6 +21,7 @@ update Update an alternate content source. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/activationkey.py b/robottelo/cli/activationkey.py index 415a682c444..8a58b2f7bb2 100644 --- a/robottelo/cli/activationkey.py +++ b/robottelo/cli/activationkey.py @@ -25,6 +25,7 @@ subscriptions List associated subscriptions update Update an activation key """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/admin.py b/robottelo/cli/admin.py index ccae4bf47db..e6a32296400 100644 --- a/robottelo/cli/admin.py +++ b/robottelo/cli/admin.py @@ -12,6 +12,7 @@ Options: -h, --help Print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/ansible.py b/robottelo/cli/ansible.py index c9d42dbcb30..d717f8cd4d6 100644 --- a/robottelo/cli/ansible.py +++ b/robottelo/cli/ansible.py @@ -8,6 +8,7 @@ roles Manage ansible roles variables Manage ansible variables """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/architecture.py b/robottelo/cli/architecture.py index 02a9a173cf4..6bad9bf55c4 100644 --- a/robottelo/cli/architecture.py +++ b/robottelo/cli/architecture.py @@ -18,6 +18,7 @@ remove_operatingsystem Disassociate a resource update Update an architecture. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/arfreport.py b/robottelo/cli/arfreport.py index 05e04c0d7c3..a478a0ecfd7 100644 --- a/robottelo/cli/arfreport.py +++ b/robottelo/cli/arfreport.py @@ -16,6 +16,7 @@ list List ARF reports """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/auth.py b/robottelo/cli/auth.py index a6995ce7361..c50cf08fb60 100644 --- a/robottelo/cli/auth.py +++ b/robottelo/cli/auth.py @@ -11,6 +11,7 @@ logout Wipe your credentials status Information about current connections """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/base.py b/robottelo/cli/base.py index 8d258500b27..2827fdba5e5 100644 --- a/robottelo/cli/base.py +++ b/robottelo/cli/base.py @@ -1,4 +1,5 @@ """Generic base class for cli hammer commands.""" + import re from wait_for import wait_for diff --git a/robottelo/cli/bootdisk.py b/robottelo/cli/bootdisk.py index 50df399f7f3..f50c817cc57 100644 --- a/robottelo/cli/bootdisk.py +++ b/robottelo/cli/bootdisk.py @@ -14,6 +14,7 @@ host Download host image subnet Download subnet generic image """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/capsule.py b/robottelo/cli/capsule.py index 1e4e4a20b36..07ec8698f8e 100644 --- a/robottelo/cli/capsule.py +++ b/robottelo/cli/capsule.py @@ -19,6 +19,7 @@ refresh-features Refresh capsule features update Update a capsule """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/computeprofile.py b/robottelo/cli/computeprofile.py index b288e9c34c6..2856138f03f 100644 --- a/robottelo/cli/computeprofile.py +++ b/robottelo/cli/computeprofile.py @@ -18,6 +18,7 @@ -h, --help Print help Update a compute resource. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/computeresource.py b/robottelo/cli/computeresource.py index 1026d163787..48823ef1690 100644 --- a/robottelo/cli/computeresource.py +++ b/robottelo/cli/computeresource.py @@ -17,6 +17,7 @@ list List all compute resources. update Update a compute resource. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/content_credentials.py b/robottelo/cli/content_credentials.py index b7582dadd48..6844ef0083f 100644 --- a/robottelo/cli/content_credentials.py +++ b/robottelo/cli/content_credentials.py @@ -16,6 +16,7 @@ list List content credentials update Update a content credential """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/content_export.py b/robottelo/cli/content_export.py index 8d67ddfc032..c868e8483a4 100644 --- a/robottelo/cli/content_export.py +++ b/robottelo/cli/content_export.py @@ -19,6 +19,7 @@ list View content view export histories """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/content_import.py b/robottelo/cli/content_import.py index 18669dd49f8..d0910433dcb 100644 --- a/robottelo/cli/content_import.py +++ b/robottelo/cli/content_import.py @@ -16,6 +16,7 @@ version Imports a content archive to a content view version """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/contentview.py b/robottelo/cli/contentview.py index fb8001f89d7..bac4dee01a9 100644 --- a/robottelo/cli/contentview.py +++ b/robottelo/cli/contentview.py @@ -33,6 +33,7 @@ -h, --help print help """ + from robottelo.cli import hammer from robottelo.cli.base import Base, CLIError diff --git a/robottelo/cli/defaults.py b/robottelo/cli/defaults.py index 7d624930f95..0c7524a65cc 100644 --- a/robottelo/cli/defaults.py +++ b/robottelo/cli/defaults.py @@ -15,6 +15,7 @@ list List all the default parameters providers List all the providers """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/discoveredhost.py b/robottelo/cli/discoveredhost.py index 6404dfc89ec..99c1edffd6b 100644 --- a/robottelo/cli/discoveredhost.py +++ b/robottelo/cli/discoveredhost.py @@ -19,6 +19,7 @@ reboot Reboot a host refresh-facts Refresh the facts of a host """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/discoveryrule.py b/robottelo/cli/discoveryrule.py index 54bb5fc872e..9685132ef88 100644 --- a/robottelo/cli/discoveryrule.py +++ b/robottelo/cli/discoveryrule.py @@ -16,6 +16,7 @@ list List all discovery rules update Update a rule """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/docker.py b/robottelo/cli/docker.py index 01fe51cb786..f12eb949e90 100644 --- a/robottelo/cli/docker.py +++ b/robottelo/cli/docker.py @@ -1,4 +1,5 @@ """Docker related hammer commands""" + from robottelo.cli.base import Base diff --git a/robottelo/cli/domain.py b/robottelo/cli/domain.py index bb449177fcd..601aefc2eb1 100644 --- a/robottelo/cli/domain.py +++ b/robottelo/cli/domain.py @@ -18,6 +18,7 @@ set_parameter Create or update parameter for a domain. update Update a domain. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/environment.py b/robottelo/cli/environment.py index f47e2ba6aaf..1c981216e79 100644 --- a/robottelo/cli/environment.py +++ b/robottelo/cli/environment.py @@ -17,6 +17,7 @@ sc-params List all smart class parameters update Update an environment """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/erratum.py b/robottelo/cli/erratum.py index abe3fa57598..762a678398e 100644 --- a/robottelo/cli/erratum.py +++ b/robottelo/cli/erratum.py @@ -13,6 +13,7 @@ info Show an erratum list List errata """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/fact.py b/robottelo/cli/fact.py index 67a6d99d52a..3521e828b36 100644 --- a/robottelo/cli/fact.py +++ b/robottelo/cli/fact.py @@ -12,6 +12,7 @@ list List all fact values. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/file.py b/robottelo/cli/file.py index 3adb1fe1663..643df551b18 100644 --- a/robottelo/cli/file.py +++ b/robottelo/cli/file.py @@ -13,6 +13,7 @@ info Show a file list List files """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/filter.py b/robottelo/cli/filter.py index 395e44e13d6..595e67584a1 100644 --- a/robottelo/cli/filter.py +++ b/robottelo/cli/filter.py @@ -17,6 +17,7 @@ list List all filters update Update a filter """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/globalparam.py b/robottelo/cli/globalparam.py index 8bca35dc3cb..2dc069a062b 100644 --- a/robottelo/cli/globalparam.py +++ b/robottelo/cli/globalparam.py @@ -14,6 +14,7 @@ list List all common parameters. set Set a global parameter. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/gpgkey.py b/robottelo/cli/gpgkey.py index 4158fa04a70..610640e1c9b 100644 --- a/robottelo/cli/gpgkey.py +++ b/robottelo/cli/gpgkey.py @@ -16,6 +16,7 @@ list List GPG Keys update Update a GPG Key """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/hammer.py b/robottelo/cli/hammer.py index b84e6bf2158..47e22cd7af0 100644 --- a/robottelo/cli/hammer.py +++ b/robottelo/cli/hammer.py @@ -1,4 +1,5 @@ """Helpers to interact with hammer command line utility.""" + import csv import json import re diff --git a/robottelo/cli/host.py b/robottelo/cli/host.py index 05f042f9dde..8121900dda0 100644 --- a/robottelo/cli/host.py +++ b/robottelo/cli/host.py @@ -39,6 +39,7 @@ update Update a host """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/host_registration.py b/robottelo/cli/host_registration.py index 8d0adaececd..61abe2a7d56 100644 --- a/robottelo/cli/host_registration.py +++ b/robottelo/cli/host_registration.py @@ -13,6 +13,7 @@ -h, --help Print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/hostcollection.py b/robottelo/cli/hostcollection.py index 839ef48d4f6..16e13d89110 100644 --- a/robottelo/cli/hostcollection.py +++ b/robottelo/cli/hostcollection.py @@ -23,6 +23,7 @@ remove-host Remove hosts from the host collection update Update a host collection """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/hostgroup.py b/robottelo/cli/hostgroup.py index 5be314b1a43..f13f7878901 100644 --- a/robottelo/cli/hostgroup.py +++ b/robottelo/cli/hostgroup.py @@ -22,6 +22,7 @@ set-parameter Create or update parameter for a hostgroup update Update a host group """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/http_proxy.py b/robottelo/cli/http_proxy.py index 08405e8d045..ba6f6b4debd 100644 --- a/robottelo/cli/http_proxy.py +++ b/robottelo/cli/http_proxy.py @@ -16,6 +16,7 @@ Options: -h, --help Print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/job_invocation.py b/robottelo/cli/job_invocation.py index e1aeacdc84e..62974e3b072 100644 --- a/robottelo/cli/job_invocation.py +++ b/robottelo/cli/job_invocation.py @@ -15,6 +15,7 @@ rerun Rerun the job """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/job_template.py b/robottelo/cli/job_template.py index 7b072cc0612..d33e77b09ea 100644 --- a/robottelo/cli/job_template.py +++ b/robottelo/cli/job_template.py @@ -16,6 +16,7 @@ list List job templates update Update a job template """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/ldapauthsource.py b/robottelo/cli/ldapauthsource.py index fabb6a9c0bd..1d460528f4f 100644 --- a/robottelo/cli/ldapauthsource.py +++ b/robottelo/cli/ldapauthsource.py @@ -15,6 +15,7 @@ list List all LDAP authentication sources update Update an LDAP authentication source """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/lifecycleenvironment.py b/robottelo/cli/lifecycleenvironment.py index c22d2268746..b6896d80f59 100644 --- a/robottelo/cli/lifecycleenvironment.py +++ b/robottelo/cli/lifecycleenvironment.py @@ -16,6 +16,7 @@ delete Destroy an environment info Show an environment """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/location.py b/robottelo/cli/location.py index aa3dd234970..82d5789139a 100644 --- a/robottelo/cli/location.py +++ b/robottelo/cli/location.py @@ -36,6 +36,7 @@ remove-user Disassociate an user update Update a location """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/medium.py b/robottelo/cli/medium.py index 8372d96a7cf..6958254b07c 100644 --- a/robottelo/cli/medium.py +++ b/robottelo/cli/medium.py @@ -18,6 +18,7 @@ remove_operatingsystem Disassociate a resource update Update a medium. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/model.py b/robottelo/cli/model.py index 419f2ff62a2..453d5a55d18 100644 --- a/robottelo/cli/model.py +++ b/robottelo/cli/model.py @@ -16,6 +16,7 @@ list List all models. update Update a model. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/module_stream.py b/robottelo/cli/module_stream.py index 1dcb8d9ee54..bc0a248e44f 100644 --- a/robottelo/cli/module_stream.py +++ b/robottelo/cli/module_stream.py @@ -13,6 +13,7 @@ info Show a module-stream list List module-streams """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/operatingsys.py b/robottelo/cli/operatingsys.py index 8bf4411d56d..361259d275e 100644 --- a/robottelo/cli/operatingsys.py +++ b/robottelo/cli/operatingsys.py @@ -27,6 +27,7 @@ operating system. update Update an OS. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/org.py b/robottelo/cli/org.py index 38103aff3a5..21d2c7c053b 100644 --- a/robottelo/cli/org.py +++ b/robottelo/cli/org.py @@ -40,6 +40,7 @@ organization. update Update an organization """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/ostreebranch.py b/robottelo/cli/ostreebranch.py index 5d68869978f..f828299133f 100644 --- a/robottelo/cli/ostreebranch.py +++ b/robottelo/cli/ostreebranch.py @@ -14,6 +14,7 @@ list List ostree_branches """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/package.py b/robottelo/cli/package.py index 75533348ad3..df566b735d9 100644 --- a/robottelo/cli/package.py +++ b/robottelo/cli/package.py @@ -13,6 +13,7 @@ info Show a package list List packages """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/partitiontable.py b/robottelo/cli/partitiontable.py index eb0ebd7fc9e..dc15e25563a 100644 --- a/robottelo/cli/partitiontable.py +++ b/robottelo/cli/partitiontable.py @@ -19,6 +19,7 @@ remove_operatingsystem Disassociate a resource update Update a ptable. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/product.py b/robottelo/cli/product.py index 7a7f03eeff4..90e0a534549 100644 --- a/robottelo/cli/product.py +++ b/robottelo/cli/product.py @@ -20,6 +20,7 @@ update Update a product update-proxy Updates an HTTP Proxy for a product """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/proxy.py b/robottelo/cli/proxy.py index c6887940902..a7722b22935 100644 --- a/robottelo/cli/proxy.py +++ b/robottelo/cli/proxy.py @@ -18,6 +18,7 @@ refresh-features Refresh smart proxy features update Update a smart proxy. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/puppet.py b/robottelo/cli/puppet.py index b340fc75a5e..acc502fafc2 100644 --- a/robottelo/cli/puppet.py +++ b/robottelo/cli/puppet.py @@ -14,6 +14,7 @@ list List all puppetclasses. sc-params List all smart class parameters """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/realm.py b/robottelo/cli/realm.py index bbbcc11b0a9..ce89717fc88 100644 --- a/robottelo/cli/realm.py +++ b/robottelo/cli/realm.py @@ -16,6 +16,7 @@ Options: -h, --help print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/recurring_logic.py b/robottelo/cli/recurring_logic.py index 71c494c68d7..85c6e7ebba6 100644 --- a/robottelo/cli/recurring_logic.py +++ b/robottelo/cli/recurring_logic.py @@ -11,6 +11,7 @@ info Show recurring logic details list List recurring logics """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/report.py b/robottelo/cli/report.py index 50ca0c1a8b9..e5dadade512 100644 --- a/robottelo/cli/report.py +++ b/robottelo/cli/report.py @@ -15,6 +15,7 @@ list List reports. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/report_template.py b/robottelo/cli/report_template.py index 962c5929bc7..9814525716b 100644 --- a/robottelo/cli/report_template.py +++ b/robottelo/cli/report_template.py @@ -21,6 +21,7 @@ schedule Schedule generating of a report update Update a report template """ + from os import chmod from tempfile import mkstemp diff --git a/robottelo/cli/repository.py b/robottelo/cli/repository.py index 94fa8baa180..084887ae93d 100644 --- a/robottelo/cli/repository.py +++ b/robottelo/cli/repository.py @@ -19,6 +19,7 @@ update Update a repository upload-content Upload content into the repository """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/repository_set.py b/robottelo/cli/repository_set.py index 65dede4e28d..7c2afb6481d 100644 --- a/robottelo/cli/repository_set.py +++ b/robottelo/cli/repository_set.py @@ -19,6 +19,7 @@ info Show a repository list List of repositories """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/role.py b/robottelo/cli/role.py index d83234fc8a0..88eb6a40cd7 100644 --- a/robottelo/cli/role.py +++ b/robottelo/cli/role.py @@ -17,6 +17,7 @@ list List all roles. update Update an role. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/scap_policy.py b/robottelo/cli/scap_policy.py index 7235d2470cf..26479007804 100644 --- a/robottelo/cli/scap_policy.py +++ b/robottelo/cli/scap_policy.py @@ -16,6 +16,7 @@ list List Policies update Update a Policy """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/scap_tailoring_files.py b/robottelo/cli/scap_tailoring_files.py index 0e75af17b46..912c25a639a 100644 --- a/robottelo/cli/scap_tailoring_files.py +++ b/robottelo/cli/scap_tailoring_files.py @@ -17,6 +17,7 @@ list List Tailoring files update Update a Tailoring file """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/scapcontent.py b/robottelo/cli/scapcontent.py index 160da1d0d1e..8e384488d8c 100644 --- a/robottelo/cli/scapcontent.py +++ b/robottelo/cli/scapcontent.py @@ -16,6 +16,7 @@ list List SCAP contents update Update an SCAP content """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/scparams.py b/robottelo/cli/scparams.py index fea0431a5e1..9e661b8f613 100644 --- a/robottelo/cli/scparams.py +++ b/robottelo/cli/scparams.py @@ -18,6 +18,7 @@ variable update Update a smart class parameter """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/settings.py b/robottelo/cli/settings.py index 49777104d4f..13c45776a51 100644 --- a/robottelo/cli/settings.py +++ b/robottelo/cli/settings.py @@ -13,6 +13,7 @@ list List all settings set Update a setting """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/simple_content_access.py b/robottelo/cli/simple_content_access.py index d5e471b824b..6f128a84f17 100644 --- a/robottelo/cli/simple_content_access.py +++ b/robottelo/cli/simple_content_access.py @@ -16,6 +16,7 @@ Simple Content Access enabled """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/sm_advanced.py b/robottelo/cli/sm_advanced.py index 42ba037b811..b6ba5808e00 100644 --- a/robottelo/cli/sm_advanced.py +++ b/robottelo/cli/sm_advanced.py @@ -88,6 +88,7 @@ Options: -h, --help print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/sm_advanced_by_tag.py b/robottelo/cli/sm_advanced_by_tag.py index afcc1018ab4..f90758e68fc 100644 --- a/robottelo/cli/sm_advanced_by_tag.py +++ b/robottelo/cli/sm_advanced_by_tag.py @@ -17,6 +17,7 @@ Options: -h, --help print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/sm_backup.py b/robottelo/cli/sm_backup.py index 8da59080151..594c2390785 100644 --- a/robottelo/cli/sm_backup.py +++ b/robottelo/cli/sm_backup.py @@ -14,6 +14,7 @@ Options: -h, --help print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/sm_health.py b/robottelo/cli/sm_health.py index f8da5ca309c..c023a943892 100644 --- a/robottelo/cli/sm_health.py +++ b/robottelo/cli/sm_health.py @@ -14,6 +14,7 @@ Options: -h, --help print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/sm_maintenance_mode.py b/robottelo/cli/sm_maintenance_mode.py index 6cbe43e367d..8e9ef09d67f 100644 --- a/robottelo/cli/sm_maintenance_mode.py +++ b/robottelo/cli/sm_maintenance_mode.py @@ -12,6 +12,7 @@ Options: -h, --help print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/sm_packages.py b/robottelo/cli/sm_packages.py index d4674279172..96aa69531bb 100644 --- a/robottelo/cli/sm_packages.py +++ b/robottelo/cli/sm_packages.py @@ -18,6 +18,7 @@ Options: -h, --help print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/sm_restore.py b/robottelo/cli/sm_restore.py index 0bd68c9fe61..cad914e5192 100644 --- a/robottelo/cli/sm_restore.py +++ b/robottelo/cli/sm_restore.py @@ -12,6 +12,7 @@ -i, --incremental Restore an incremental backup -h, --help print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/sm_service.py b/robottelo/cli/sm_service.py index c2ec5f32ca7..212d33bda19 100644 --- a/robottelo/cli/sm_service.py +++ b/robottelo/cli/sm_service.py @@ -18,6 +18,7 @@ Options: -h, --help print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/sm_upgrade.py b/robottelo/cli/sm_upgrade.py index 77712b41593..a30e1582182 100644 --- a/robottelo/cli/sm_upgrade.py +++ b/robottelo/cli/sm_upgrade.py @@ -14,6 +14,7 @@ Options: -h, --help print help """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/srpm.py b/robottelo/cli/srpm.py index 62578bbaa69..689a17c64ef 100644 --- a/robottelo/cli/srpm.py +++ b/robottelo/cli/srpm.py @@ -10,6 +10,7 @@ info Show a SRPM Details list List srpms """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/subnet.py b/robottelo/cli/subnet.py index e0bf4a0d6bd..5fc61ddc561 100644 --- a/robottelo/cli/subnet.py +++ b/robottelo/cli/subnet.py @@ -17,6 +17,7 @@ update Update a subnet """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/subscription.py b/robottelo/cli/subscription.py index 0e22eaeaccd..916a9068155 100644 --- a/robottelo/cli/subscription.py +++ b/robottelo/cli/subscription.py @@ -18,6 +18,7 @@ upload Upload a subscription manifest """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/syncplan.py b/robottelo/cli/syncplan.py index 151a72acb84..2966a349fc4 100644 --- a/robottelo/cli/syncplan.py +++ b/robottelo/cli/syncplan.py @@ -16,6 +16,7 @@ list List sync plans update """ + from robottelo.cli.base import Base from robottelo.exceptions import CLIError diff --git a/robottelo/cli/task.py b/robottelo/cli/task.py index b2a25142407..79a19c3034c 100644 --- a/robottelo/cli/task.py +++ b/robottelo/cli/task.py @@ -14,6 +14,7 @@ progress Show the progress of the task resume Resume all tasks paused in error state """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/template.py b/robottelo/cli/template.py index 3729fc4bf76..e2836346a9c 100644 --- a/robottelo/cli/template.py +++ b/robottelo/cli/template.py @@ -20,6 +20,7 @@ remove-operatingsystem Disassociate an operating system update Update a provisioning template """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/template_input.py b/robottelo/cli/template_input.py index cfe548384c3..d8cf782f783 100644 --- a/robottelo/cli/template_input.py +++ b/robottelo/cli/template_input.py @@ -15,6 +15,7 @@ info Show template input details list List template inputs """ + from robottelo.cli.base import Base, CLIError diff --git a/robottelo/cli/template_sync.py b/robottelo/cli/template_sync.py index 72ee70fa00f..e3da9dbf20c 100644 --- a/robottelo/cli/template_sync.py +++ b/robottelo/cli/template_sync.py @@ -39,6 +39,7 @@ prefix The string all imported templates should begin with. repo Override the default repo from settings. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/user.py b/robottelo/cli/user.py index e624a1b5ad4..4a2e6da34d6 100644 --- a/robottelo/cli/user.py +++ b/robottelo/cli/user.py @@ -20,6 +20,7 @@ ssh-keys Managing User SSH Keys. update Update an user. """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/usergroup.py b/robottelo/cli/usergroup.py index cd40ac96bc5..34d57fcc12a 100644 --- a/robottelo/cli/usergroup.py +++ b/robottelo/cli/usergroup.py @@ -20,6 +20,7 @@ remove-user-group Disassociate an user group update Update a user group """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/virt_who_config.py b/robottelo/cli/virt_who_config.py index 4cb6dd1223b..7e2e2e05b6b 100644 --- a/robottelo/cli/virt_who_config.py +++ b/robottelo/cli/virt_who_config.py @@ -19,6 +19,7 @@ list List of virt-who configurations update Update a virt-who configuration """ + from robottelo.cli.base import Base diff --git a/robottelo/cli/webhook.py b/robottelo/cli/webhook.py index c7b93f76d99..eb0e41905b5 100644 --- a/robottelo/cli/webhook.py +++ b/robottelo/cli/webhook.py @@ -13,12 +13,12 @@ Options: -h, --help Print help """ + from robottelo.cli.base import Base, CLIError from robottelo.constants import WEBHOOK_EVENTS, WEBHOOK_METHODS class Webhook(Base): - command_base = 'webhook' @classmethod diff --git a/robottelo/constants/__init__.py b/robottelo/constants/__init__.py index c9896470bb7..ecf82f8b9ad 100644 --- a/robottelo/constants/__init__.py +++ b/robottelo/constants/__init__.py @@ -1,4 +1,5 @@ """Defines various constants""" + from pathlib import Path from box import Box diff --git a/robottelo/content_info.py b/robottelo/content_info.py index fd404f5a7d9..803692a0823 100644 --- a/robottelo/content_info.py +++ b/robottelo/content_info.py @@ -1,4 +1,5 @@ """Miscellaneous content helper functions""" + import os import re diff --git a/robottelo/host_helpers/api_factory.py b/robottelo/host_helpers/api_factory.py index da6a39ecd76..7b4a6ca7b91 100644 --- a/robottelo/host_helpers/api_factory.py +++ b/robottelo/host_helpers/api_factory.py @@ -2,6 +2,7 @@ It is not meant to be used directly, but as part of a robottelo.hosts.Satellite instance example: my_satellite.api_factory.api_method() """ + from contextlib import contextmanager import time diff --git a/robottelo/host_helpers/cli_factory.py b/robottelo/host_helpers/cli_factory.py index 3cd6aaaf055..f6194db8287 100644 --- a/robottelo/host_helpers/cli_factory.py +++ b/robottelo/host_helpers/cli_factory.py @@ -3,6 +3,7 @@ It is not meant to be used directly, but as part of a robottelo.hosts.Satellite instance example: my_satellite.cli_factory.make_org() """ + import datetime from functools import lru_cache, partial import inspect diff --git a/robottelo/host_helpers/contenthost_mixins.py b/robottelo/host_helpers/contenthost_mixins.py index 96da029d148..074e15c35e1 100644 --- a/robottelo/host_helpers/contenthost_mixins.py +++ b/robottelo/host_helpers/contenthost_mixins.py @@ -1,4 +1,5 @@ """A collection of mixins for robottelo.hosts classes""" + from functools import cached_property import json from tempfile import NamedTemporaryFile diff --git a/robottelo/host_helpers/repository_mixins.py b/robottelo/host_helpers/repository_mixins.py index d65762cd40c..ede06f5d232 100644 --- a/robottelo/host_helpers/repository_mixins.py +++ b/robottelo/host_helpers/repository_mixins.py @@ -2,6 +2,7 @@ All the Repository classes in this module are supposed to use from sat_object.cli_factory object. The direct import of the repo classes in this module is prohibited !!!!! """ + import inspect import sys @@ -503,7 +504,6 @@ class RepositoryCollection: satellite = None def __init__(self, distro=None, repositories=None): - self._items = [] if distro is not None and distro not in constants.DISTROS_SUPPORTED: diff --git a/robottelo/host_helpers/satellite_mixins.py b/robottelo/host_helpers/satellite_mixins.py index 9507efd0d1b..25eceeda788 100644 --- a/robottelo/host_helpers/satellite_mixins.py +++ b/robottelo/host_helpers/satellite_mixins.py @@ -307,7 +307,7 @@ def validate_pulp_filepath( ): """Checks the existence of certain files in a pulp dir""" extension_query = ' -o '.join([f'-name "{file}"' for file in file_names]) - result = self.execute(fr'find {dir_path}{org.name} -type f \( {extension_query} \)') + result = self.execute(rf'find {dir_path}{org.name} -type f \( {extension_query} \)') return result.stdout diff --git a/robottelo/host_helpers/ui_factory.py b/robottelo/host_helpers/ui_factory.py index df156ad6d6f..84c1498bcd5 100644 --- a/robottelo/host_helpers/ui_factory.py +++ b/robottelo/host_helpers/ui_factory.py @@ -3,6 +3,7 @@ Need to pass the existing session object to the ui_factory method as a parameter example: my_satellite.ui_factory(session).ui_method() """ + from fauxfactory import gen_string from robottelo.constants import DEFAULT_CV, ENVIRONMENT diff --git a/robottelo/hosts.py b/robottelo/hosts.py index 5bf97d17887..17c084eaa01 100644 --- a/robottelo/hosts.py +++ b/robottelo/hosts.py @@ -56,7 +56,7 @@ POWER_OPERATIONS = { VmState.RUNNING: 'running', VmState.STOPPED: 'stopped', - 'reboot': 'reboot' + 'reboot': 'reboot', # TODO paused, suspended, shelved? } @@ -816,10 +816,7 @@ def register_contenthost( registration. """ - if username and password: - userpass = f' --username {username} --password {password}' - else: - userpass = '' + userpass = f' --username {username} --password {password}' if username and password else '' # Setup the base command cmd = 'subscription-manager register' if org: diff --git a/robottelo/ssh.py b/robottelo/ssh.py index 8b72bed3497..1be3a65a811 100644 --- a/robottelo/ssh.py +++ b/robottelo/ssh.py @@ -1,4 +1,5 @@ """Utility module to handle the shared ssh connection.""" + from robottelo.cli import hammer diff --git a/robottelo/utils/datafactory.py b/robottelo/utils/datafactory.py index c5ccc38ba14..81e8dcfc3ac 100644 --- a/robottelo/utils/datafactory.py +++ b/robottelo/utils/datafactory.py @@ -1,4 +1,5 @@ """Data Factory for all entities""" + from functools import wraps import random import string diff --git a/robottelo/utils/decorators/__init__.py b/robottelo/utils/decorators/__init__.py index 371afd50f16..3dd3c9edeb3 100644 --- a/robottelo/utils/decorators/__init__.py +++ b/robottelo/utils/decorators/__init__.py @@ -1,4 +1,5 @@ """Implements various decorators""" + from functools import wraps OBJECT_CACHE = {} diff --git a/robottelo/utils/decorators/func_locker.py b/robottelo/utils/decorators/func_locker.py index e4feaa46f2a..83632428313 100644 --- a/robottelo/utils/decorators/func_locker.py +++ b/robottelo/utils/decorators/func_locker.py @@ -39,6 +39,7 @@ def test_that_conflict_with_test_to_lock(self) with locking_function(self.test_to_lock): # do some operations that conflict with test_to_lock """ + from contextlib import contextmanager import functools import inspect @@ -223,7 +224,6 @@ def lock_function( class_name = '.'.join(class_names) def main_wrapper(func): - func.__class_name__ = class_name func.__function_locked__ = True diff --git a/robottelo/utils/decorators/func_shared/file_storage.py b/robottelo/utils/decorators/func_shared/file_storage.py index 70a6d6af889..e7935300c86 100644 --- a/robottelo/utils/decorators/func_shared/file_storage.py +++ b/robottelo/utils/decorators/func_shared/file_storage.py @@ -45,7 +45,6 @@ class FileStorageHandler(BaseStorageHandler): """Key value file storage handler.""" def __init__(self, root_dir=None, create=True, lock_timeout=LOCK_TIMEOUT): - if root_dir is None: root_dir = _get_root_dir() diff --git a/robottelo/utils/decorators/func_shared/redis_storage.py b/robottelo/utils/decorators/func_shared/redis_storage.py index 571ac0ac699..74a5b8d0ecc 100644 --- a/robottelo/utils/decorators/func_shared/redis_storage.py +++ b/robottelo/utils/decorators/func_shared/redis_storage.py @@ -23,7 +23,6 @@ def __init__( password=REDIS_PASSWORD, lock_timeout=LOCK_TIMEOUT, ): - self._lock_timeout = lock_timeout self._client = redis.StrictRedis(host=host, port=port, db=db, password=password) diff --git a/robottelo/utils/decorators/func_shared/shared.py b/robottelo/utils/decorators/func_shared/shared.py index 4c325084c4f..50e2d371fbe 100644 --- a/robottelo/utils/decorators/func_shared/shared.py +++ b/robottelo/utils/decorators/func_shared/shared.py @@ -84,6 +84,7 @@ def shared_class_method(cls, org=None, repo=None): return dict(org=cls.org, repo=cls.repo} """ + import datetime import functools import hashlib @@ -213,7 +214,6 @@ def __init__( inject=False, injected_kw='_inject', ): - if storage_handler is None: storage_handler = _get_default_storage_handler() @@ -258,7 +258,6 @@ def _encode_result_kwargs(self, kwargs): return kwargs def _call_function(self): - retries = self._max_retries if not retries: retries = 1 @@ -465,11 +464,7 @@ def _get_function_name_key(function_name, scope=None, scope_kwargs=None, scope_c scope_name = _get_scope_name( scope=scope, scope_kwargs=scope_kwargs, scope_context=scope_context ) - if scope_name: - function_name_key = '.'.join([scope_name, function_name]) - else: - function_name_key = function_name - return function_name_key + return '.'.join([scope_name, function_name]) if scope_name else function_name def shared( diff --git a/robottelo/utils/manifest.py b/robottelo/utils/manifest.py index 52c220f3c59..aa377ae73e3 100644 --- a/robottelo/utils/manifest.py +++ b/robottelo/utils/manifest.py @@ -69,9 +69,9 @@ def manifest_clone(self, org_environment_access=False, name='default'): consumer_data['uuid'] = str(uuid.uuid1()) if org_environment_access: consumer_data['contentAccessMode'] = 'org_environment' - consumer_data['owner'][ - 'contentAccessModeList' - ] = 'entitlement,org_environment' + consumer_data['owner']['contentAccessModeList'] = ( + 'entitlement,org_environment' + ) new_consumer_export_zip.writestr(name, json.dumps(consumer_data)) else: new_consumer_export_zip.writestr(name, consumer_export_zip.read(name)) diff --git a/robottelo/utils/ohsnap.py b/robottelo/utils/ohsnap.py index 96241a759b6..83669cdb61e 100644 --- a/robottelo/utils/ohsnap.py +++ b/robottelo/utils/ohsnap.py @@ -1,4 +1,5 @@ """Utility module to communicate with Ohsnap API""" + from box import Box from packaging.version import Version import requests diff --git a/robottelo/utils/shared_resource.py b/robottelo/utils/shared_resource.py index 0ad0bd92e46..fa17f3f0c14 100644 --- a/robottelo/utils/shared_resource.py +++ b/robottelo/utils/shared_resource.py @@ -21,6 +21,7 @@ ... yield target_sat # give the upgraded satellite to the test ... # Do post-upgrade cleanup steps if any """ + import json from pathlib import Path import time diff --git a/robottelo/utils/ssh.py b/robottelo/utils/ssh.py index 8b72bed3497..1be3a65a811 100644 --- a/robottelo/utils/ssh.py +++ b/robottelo/utils/ssh.py @@ -1,4 +1,5 @@ """Utility module to handle the shared ssh connection.""" + from robottelo.cli import hammer diff --git a/robottelo/utils/vault.py b/robottelo/utils/vault.py index 97f95755bbd..417fa2c13bd 100644 --- a/robottelo/utils/vault.py +++ b/robottelo/utils/vault.py @@ -1,4 +1,5 @@ """Hashicorp Vault Utils where vault CLI is wrapped to perform vault operations""" + import json import os import re diff --git a/robottelo/utils/virtwho.py b/robottelo/utils/virtwho.py index 9d2b033d6ee..0013071fba9 100644 --- a/robottelo/utils/virtwho.py +++ b/robottelo/utils/virtwho.py @@ -1,4 +1,5 @@ """Utility module to handle the virtwho configure UI/CLI/API testing""" + import json import re import uuid diff --git a/scripts/config_helpers.py b/scripts/config_helpers.py index cf422588b05..bc559c5091b 100644 --- a/scripts/config_helpers.py +++ b/scripts/config_helpers.py @@ -1,4 +1,5 @@ """A series of commands to help with robottelo configuration""" + from pathlib import Path import click diff --git a/scripts/graph_entities.py b/scripts/graph_entities.py index 46038a3e3b0..bd4accfa2ed 100755 --- a/scripts/graph_entities.py +++ b/scripts/graph_entities.py @@ -7,6 +7,7 @@ command provided by the make file in the parent directory. """ + import inspect from nailgun import entities, entity_mixins diff --git a/scripts/hammer_command_tree.py b/scripts/hammer_command_tree.py index 55a10add78e..580447047cc 100755 --- a/scripts/hammer_command_tree.py +++ b/scripts/hammer_command_tree.py @@ -2,6 +2,7 @@ help. """ + import json from robottelo import ssh diff --git a/scripts/token_editor.py b/scripts/token_editor.py index 923aef02aa0..f492c8c3fb2 100755 --- a/scripts/token_editor.py +++ b/scripts/token_editor.py @@ -4,6 +4,7 @@ Reads Python test modules under test/foreman and edit docstring tokens' prefix from ``OLD_TOKEN_PREFIX`` to ``NEW_TOKEN_PREFIX``. """ + import glob import os import re @@ -30,6 +31,6 @@ for test_module in test_modules: with open(test_module) as handler: content = handler.read() - content = TOKEN_RE.sub(fr'{NEW_TOKEN_PREFIX}\1:', content) + content = TOKEN_RE.sub(rf'{NEW_TOKEN_PREFIX}\1:', content) with open(test_module, 'w') as handler: handler.write(content) diff --git a/scripts/tokenize_customer_scenario.py b/scripts/tokenize_customer_scenario.py index 14a0cbf75a5..f810e00c4e0 100644 --- a/scripts/tokenize_customer_scenario.py +++ b/scripts/tokenize_customer_scenario.py @@ -13,6 +13,7 @@ On robottelo root dir run: $ python scripts/tokenize_customer_scenario.py """ + import codemod from codemod import Query, regex_suggestor, run_interactive from codemod.helpers import path_filter diff --git a/scripts/validate_config.py b/scripts/validate_config.py index a01f350ae6e..04af5d7ac48 100644 --- a/scripts/validate_config.py +++ b/scripts/validate_config.py @@ -1,4 +1,5 @@ """Usage: python scripts/validate_config.py""" + from dynaconf.validator import ValidationError from robottelo.config import get_settings diff --git a/tests/foreman/api/test_acs.py b/tests/foreman/api/test_acs.py index 7821db07fc5..a8b24345bc6 100644 --- a/tests/foreman/api/test_acs.py +++ b/tests/foreman/api/test_acs.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/api/test_activationkey.py b/tests/foreman/api/test_activationkey.py index d07bcc2f71f..b5418784440 100644 --- a/tests/foreman/api/test_activationkey.py +++ b/tests/foreman/api/test_activationkey.py @@ -12,6 +12,7 @@ """ + import http from fauxfactory import gen_integer, gen_string diff --git a/tests/foreman/api/test_ansible.py b/tests/foreman/api/test_ansible.py index f59a17e6ccb..754e7bdb4ea 100644 --- a/tests/foreman/api/test_ansible.py +++ b/tests/foreman/api/test_ansible.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + from fauxfactory import gen_string import pytest from wait_for import wait_for diff --git a/tests/foreman/api/test_architecture.py b/tests/foreman/api/test_architecture.py index 362abbfae32..b40173fe21f 100644 --- a/tests/foreman/api/test_architecture.py +++ b/tests/foreman/api/test_architecture.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_choice import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/api/test_audit.py b/tests/foreman/api/test_audit.py index 3f0ccc290d6..12f4b1c9334 100644 --- a/tests/foreman/api/test_audit.py +++ b/tests/foreman/api/test_audit.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.utils.datafactory import gen_string diff --git a/tests/foreman/api/test_bookmarks.py b/tests/foreman/api/test_bookmarks.py index 5d5833ef563..9b532a48155 100644 --- a/tests/foreman/api/test_bookmarks.py +++ b/tests/foreman/api/test_bookmarks.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from fauxfactory import gen_string diff --git a/tests/foreman/api/test_capsule.py b/tests/foreman/api/test_capsule.py index 7cbb989f940..5600cc040a8 100644 --- a/tests/foreman/api/test_capsule.py +++ b/tests/foreman/api/test_capsule.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + from fauxfactory import gen_string, gen_url import pytest from requests import HTTPError diff --git a/tests/foreman/api/test_capsulecontent.py b/tests/foreman/api/test_capsulecontent.py index 6c26d0e0280..8cd5ffa119c 100644 --- a/tests/foreman/api/test_capsulecontent.py +++ b/tests/foreman/api/test_capsulecontent.py @@ -12,6 +12,7 @@ :CaseImportance: High """ + from datetime import datetime import re from time import sleep diff --git a/tests/foreman/api/test_classparameters.py b/tests/foreman/api/test_classparameters.py index 931a11edec2..d74e708bd61 100644 --- a/tests/foreman/api/test_classparameters.py +++ b/tests/foreman/api/test_classparameters.py @@ -11,6 +11,7 @@ :Team: Rocket """ + import json from random import choice diff --git a/tests/foreman/api/test_computeprofile.py b/tests/foreman/api/test_computeprofile.py index 6d374bc8b34..785278ee2b6 100644 --- a/tests/foreman/api/test_computeprofile.py +++ b/tests/foreman/api/test_computeprofile.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/api/test_computeresource_azurerm.py b/tests/foreman/api/test_computeresource_azurerm.py index 47bf8313066..d8751f65786 100644 --- a/tests/foreman/api/test_computeresource_azurerm.py +++ b/tests/foreman/api/test_computeresource_azurerm.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/api/test_computeresource_gce.py b/tests/foreman/api/test_computeresource_gce.py index 2d088f4f2a2..8f27e9b98fe 100644 --- a/tests/foreman/api/test_computeresource_gce.py +++ b/tests/foreman/api/test_computeresource_gce.py @@ -14,6 +14,7 @@ :CaseImportance: High """ + import random from fauxfactory import gen_string diff --git a/tests/foreman/api/test_computeresource_libvirt.py b/tests/foreman/api/test_computeresource_libvirt.py index ad95fb9f202..ce0c0ff0b9b 100644 --- a/tests/foreman/api/test_computeresource_libvirt.py +++ b/tests/foreman/api/test_computeresource_libvirt.py @@ -15,6 +15,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/api/test_contentcredentials.py b/tests/foreman/api/test_contentcredentials.py index 3f088ae6253..2263edca0d1 100644 --- a/tests/foreman/api/test_contentcredentials.py +++ b/tests/foreman/api/test_contentcredentials.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from copy import copy from fauxfactory import gen_string diff --git a/tests/foreman/api/test_contentview.py b/tests/foreman/api/test_contentview.py index e43ecd4d0b6..9f4c4ce6faf 100644 --- a/tests/foreman/api/test_contentview.py +++ b/tests/foreman/api/test_contentview.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from fauxfactory import gen_integer, gen_string, gen_utf8 diff --git a/tests/foreman/api/test_contentviewfilter.py b/tests/foreman/api/test_contentviewfilter.py index f17d256d802..3c876830b58 100644 --- a/tests/foreman/api/test_contentviewfilter.py +++ b/tests/foreman/api/test_contentviewfilter.py @@ -15,6 +15,7 @@ :CaseImportance: High """ + import http from random import randint diff --git a/tests/foreman/api/test_contentviewversion.py b/tests/foreman/api/test_contentviewversion.py index 5f3414456e3..b870ffb19f7 100644 --- a/tests/foreman/api/test_contentviewversion.py +++ b/tests/foreman/api/test_contentviewversion.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/api/test_convert2rhel.py b/tests/foreman/api/test_convert2rhel.py index dd10f85de4d..b2458af6cfe 100644 --- a/tests/foreman/api/test_convert2rhel.py +++ b/tests/foreman/api/test_convert2rhel.py @@ -11,6 +11,7 @@ :Team: Rocket """ + import pytest import requests diff --git a/tests/foreman/api/test_discoveredhost.py b/tests/foreman/api/test_discoveredhost.py index 976c1812e47..31ad0b1d415 100644 --- a/tests/foreman/api/test_discoveredhost.py +++ b/tests/foreman/api/test_discoveredhost.py @@ -9,6 +9,7 @@ :CaseAutomation: Automated """ + import re from fauxfactory import gen_choice, gen_ipaddr, gen_mac, gen_string diff --git a/tests/foreman/api/test_discoveryrule.py b/tests/foreman/api/test_discoveryrule.py index 3d1c1f4bf48..2ffddb51711 100644 --- a/tests/foreman/api/test_discoveryrule.py +++ b/tests/foreman/api/test_discoveryrule.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_choice, gen_integer, gen_string import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/api/test_docker.py b/tests/foreman/api/test_docker.py index eab9d213db5..6bebe5e81f1 100644 --- a/tests/foreman/api/test_docker.py +++ b/tests/foreman/api/test_docker.py @@ -7,6 +7,7 @@ :CaseImportance: High """ + from random import choice, randint, shuffle from fauxfactory import gen_string, gen_url diff --git a/tests/foreman/api/test_environment.py b/tests/foreman/api/test_environment.py index 02f7a3928e3..d0e62dbe6a9 100644 --- a/tests/foreman/api/test_environment.py +++ b/tests/foreman/api/test_environment.py @@ -15,6 +15,7 @@ :CaseImportance: Critical """ + from fauxfactory import gen_string import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/api/test_errata.py b/tests/foreman/api/test_errata.py index cb831425778..725cda094ca 100644 --- a/tests/foreman/api/test_errata.py +++ b/tests/foreman/api/test_errata.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + # For ease of use hc refers to host-collection throughout this document from time import sleep @@ -125,8 +126,7 @@ def _validate_errata_counts(module_org, host, errata_type, expected_value, timeo sleep(5) else: pytest.fail( - 'Host {} contains {} {} errata, but expected to contain ' - '{} of them'.format( + 'Host {} contains {} {} errata, but expected to contain {} of them'.format( host.name, host.content_facet_attributes['errata_counts'][errata_type], errata_type, @@ -145,8 +145,9 @@ def _fetch_available_errata(module_org, host, expected_amount, timeout=120): errata = host.errata() else: pytest.fail( - 'Host {} contains {} available errata, but expected to ' - 'contain {} of them'.format(host.name, len(errata['results']), expected_amount) + 'Host {} contains {} available errata, but expected to contain {} of them'.format( + host.name, len(errata['results']), expected_amount + ) ) diff --git a/tests/foreman/api/test_foremantask.py b/tests/foreman/api/test_foremantask.py index c736a0e7161..0cab1253369 100644 --- a/tests/foreman/api/test_foremantask.py +++ b/tests/foreman/api/test_foremantask.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/api/test_host.py b/tests/foreman/api/test_host.py index 94730d56925..0982a161921 100644 --- a/tests/foreman/api/test_host.py +++ b/tests/foreman/api/test_host.py @@ -15,6 +15,7 @@ :CaseImportance: High """ + import http from fauxfactory import gen_choice, gen_integer, gen_ipaddr, gen_mac, gen_string diff --git a/tests/foreman/api/test_hostcollection.py b/tests/foreman/api/test_hostcollection.py index 985f989718e..3675b7a40b0 100644 --- a/tests/foreman/api/test_hostcollection.py +++ b/tests/foreman/api/test_hostcollection.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from random import choice, randint from broker import Broker diff --git a/tests/foreman/api/test_hostgroup.py b/tests/foreman/api/test_hostgroup.py index e0e6fd9ed91..5313ec0400f 100644 --- a/tests/foreman/api/test_hostgroup.py +++ b/tests/foreman/api/test_hostgroup.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from random import randint from fauxfactory import gen_string diff --git a/tests/foreman/api/test_http_proxy.py b/tests/foreman/api/test_http_proxy.py index 51ceb485361..04d12a2df2b 100644 --- a/tests/foreman/api/test_http_proxy.py +++ b/tests/foreman/api/test_http_proxy.py @@ -11,6 +11,7 @@ :CaseAutomation: Automated """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/api/test_ldapauthsource.py b/tests/foreman/api/test_ldapauthsource.py index 885d290e741..09742a8ff8d 100644 --- a/tests/foreman/api/test_ldapauthsource.py +++ b/tests/foreman/api/test_ldapauthsource.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/api/test_lifecycleenvironment.py b/tests/foreman/api/test_lifecycleenvironment.py index b68017efb87..61ec1a69a02 100644 --- a/tests/foreman/api/test_lifecycleenvironment.py +++ b/tests/foreman/api/test_lifecycleenvironment.py @@ -15,6 +15,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/api/test_location.py b/tests/foreman/api/test_location.py index 2e54a4862fa..28c2d9c0b25 100644 --- a/tests/foreman/api/test_location.py +++ b/tests/foreman/api/test_location.py @@ -14,6 +14,7 @@ :CaseImportance: High """ + from random import randint from fauxfactory import gen_integer, gen_string diff --git a/tests/foreman/api/test_media.py b/tests/foreman/api/test_media.py index 79c5cb7f20e..f58f7982176 100644 --- a/tests/foreman/api/test_media.py +++ b/tests/foreman/api/test_media.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from fauxfactory import gen_string, gen_url @@ -38,7 +39,7 @@ def class_media(self, module_org, class_target_sat): ('name', 'new_name'), **parametrized( list(zip(valid_data_list().values(), valid_data_list().values(), strict=True)) - ) + ), ) def test_positive_crud_with_name(self, module_org, name, new_name, module_target_sat): """Create, update, delete media with valid name only diff --git a/tests/foreman/api/test_multiple_paths.py b/tests/foreman/api/test_multiple_paths.py index 8c683ca309a..b179e487fb7 100644 --- a/tests/foreman/api/test_multiple_paths.py +++ b/tests/foreman/api/test_multiple_paths.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import http from nailgun import client, entities, entity_fields diff --git a/tests/foreman/api/test_operatingsystem.py b/tests/foreman/api/test_operatingsystem.py index 9263ca6b309..92356158054 100644 --- a/tests/foreman/api/test_operatingsystem.py +++ b/tests/foreman/api/test_operatingsystem.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + from http.client import NOT_FOUND import random diff --git a/tests/foreman/api/test_organization.py b/tests/foreman/api/test_organization.py index 7edc09d0dc2..a2de908dc98 100644 --- a/tests/foreman/api/test_organization.py +++ b/tests/foreman/api/test_organization.py @@ -14,6 +14,7 @@ :CaseImportance: High """ + import http import json from random import randint diff --git a/tests/foreman/api/test_oscap_tailoringfiles.py b/tests/foreman/api/test_oscap_tailoringfiles.py index af6b5f47a65..7d02bb7e9aa 100644 --- a/tests/foreman/api/test_oscap_tailoringfiles.py +++ b/tests/foreman/api/test_oscap_tailoringfiles.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.utils.datafactory import gen_string diff --git a/tests/foreman/api/test_oscappolicy.py b/tests/foreman/api/test_oscappolicy.py index ba318c801cb..f927944c7dd 100644 --- a/tests/foreman/api/test_oscappolicy.py +++ b/tests/foreman/api/test_oscappolicy.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/api/test_parameters.py b/tests/foreman/api/test_parameters.py index 8e2865fbb93..a0dc82ef31f 100644 --- a/tests/foreman/api/test_parameters.py +++ b/tests/foreman/api/test_parameters.py @@ -10,6 +10,7 @@ :CaseImportance: Critical """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/api/test_partitiontable.py b/tests/foreman/api/test_partitiontable.py index 9b8e2a29d2c..f9302e47360 100644 --- a/tests/foreman/api/test_partitiontable.py +++ b/tests/foreman/api/test_partitiontable.py @@ -15,6 +15,7 @@ :CaseImportance: High """ + import random from fauxfactory import gen_integer, gen_string diff --git a/tests/foreman/api/test_permission.py b/tests/foreman/api/test_permission.py index 2c211ee1ca2..25bf17cf8a2 100644 --- a/tests/foreman/api/test_permission.py +++ b/tests/foreman/api/test_permission.py @@ -15,6 +15,7 @@ :CaseImportance: High """ + from itertools import chain import json import re diff --git a/tests/foreman/api/test_ping.py b/tests/foreman/api/test_ping.py index 5c3c905df8f..633a3390911 100644 --- a/tests/foreman/api/test_ping.py +++ b/tests/foreman/api/test_ping.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest pytestmark = [pytest.mark.tier1, pytest.mark.upgrade] diff --git a/tests/foreman/api/test_product.py b/tests/foreman/api/test_product.py index 7915ddd2de7..cbaf08fbd74 100644 --- a/tests/foreman/api/test_product.py +++ b/tests/foreman/api/test_product.py @@ -14,6 +14,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/api/test_provisioning.py b/tests/foreman/api/test_provisioning.py index b6ca79176be..dcff1295da3 100644 --- a/tests/foreman/api/test_provisioning.py +++ b/tests/foreman/api/test_provisioning.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import re from fauxfactory import gen_string diff --git a/tests/foreman/api/test_provisioning_puppet.py b/tests/foreman/api/test_provisioning_puppet.py index ec1791f1a17..504fcb92bf3 100644 --- a/tests/foreman/api/test_provisioning_puppet.py +++ b/tests/foreman/api/test_provisioning_puppet.py @@ -11,6 +11,7 @@ :CaseImportance: Medium """ + from fauxfactory import gen_string from packaging.version import Version import pytest diff --git a/tests/foreman/api/test_provisioningtemplate.py b/tests/foreman/api/test_provisioningtemplate.py index 439f75ad1be..9ebbd11443c 100644 --- a/tests/foreman/api/test_provisioningtemplate.py +++ b/tests/foreman/api/test_provisioningtemplate.py @@ -14,6 +14,7 @@ :CaseImportance: High """ + from random import choice from fauxfactory import gen_choice, gen_integer, gen_mac, gen_string diff --git a/tests/foreman/api/test_registration.py b/tests/foreman/api/test_registration.py index ac14f3efc88..9fd6e36880e 100644 --- a/tests/foreman/api/test_registration.py +++ b/tests/foreman/api/test_registration.py @@ -11,6 +11,7 @@ :Team: Rocket """ + import uuid from fauxfactory import gen_ipaddr, gen_mac diff --git a/tests/foreman/api/test_remoteexecution.py b/tests/foreman/api/test_remoteexecution.py index f0c887a80f8..bdaa303233f 100644 --- a/tests/foreman/api/test_remoteexecution.py +++ b/tests/foreman/api/test_remoteexecution.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/api/test_reporttemplates.py b/tests/foreman/api/test_reporttemplates.py index 25811698f36..a3b5ddbf03d 100644 --- a/tests/foreman/api/test_reporttemplates.py +++ b/tests/foreman/api/test_reporttemplates.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from broker import Broker from fauxfactory import gen_string import pytest diff --git a/tests/foreman/api/test_repositories.py b/tests/foreman/api/test_repositories.py index 9d576b55f38..76658c361bc 100644 --- a/tests/foreman/api/test_repositories.py +++ b/tests/foreman/api/test_repositories.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + from manifester import Manifester from nailgun.entity_mixins import call_entity_method_with_timeout import pytest diff --git a/tests/foreman/api/test_repository.py b/tests/foreman/api/test_repository.py index 7064fb456cd..c5cb50146d0 100644 --- a/tests/foreman/api/test_repository.py +++ b/tests/foreman/api/test_repository.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import re from string import punctuation import tempfile @@ -1716,7 +1717,7 @@ def test_negative_synchronize_private_registry_wrong_repo(self, repo_options, re :BZ: 1475121, 1580510 """ - msg = "404, message=\'Not Found\'" + msg = "404, message='Not Found'" with pytest.raises(TaskFailedError, match=msg): repo.sync() diff --git a/tests/foreman/api/test_repository_set.py b/tests/foreman/api/test_repository_set.py index 8f8c56ea04e..1b80b0722e4 100644 --- a/tests/foreman/api/test_repository_set.py +++ b/tests/foreman/api/test_repository_set.py @@ -14,6 +14,7 @@ :CaseImportance: High """ + import pytest from robottelo.constants import PRDS, REPOSET diff --git a/tests/foreman/api/test_rhc.py b/tests/foreman/api/test_rhc.py index 391277bfb38..fa39c4cb320 100644 --- a/tests/foreman/api/test_rhc.py +++ b/tests/foreman/api/test_rhc.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/api/test_rhcloud_inventory.py b/tests/foreman/api/test_rhcloud_inventory.py index 5f03e8bd26b..d8adc9db80a 100644 --- a/tests/foreman/api/test_rhcloud_inventory.py +++ b/tests/foreman/api/test_rhcloud_inventory.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_alphanumeric, gen_string import pytest diff --git a/tests/foreman/api/test_rhsm.py b/tests/foreman/api/test_rhsm.py index 096163a8719..2cf6c96562c 100644 --- a/tests/foreman/api/test_rhsm.py +++ b/tests/foreman/api/test_rhsm.py @@ -15,6 +15,7 @@ :CaseImportance: High """ + import http from nailgun import client diff --git a/tests/foreman/api/test_role.py b/tests/foreman/api/test_role.py index 7d5a12bc591..a9f3211fa49 100644 --- a/tests/foreman/api/test_role.py +++ b/tests/foreman/api/test_role.py @@ -15,6 +15,7 @@ :CaseImportance: High """ + from nailgun.config import ServerConfig import pytest from requests.exceptions import HTTPError @@ -183,7 +184,7 @@ def create_ldap(self, ad_data, target_sat, module_location, module_org): ldap_user_passwd=ad_data['ldap_user_passwd'], authsource=target_sat.api.AuthSourceLDAP( onthefly_register=True, - account=fr"{ad_data['workgroup']}\{ad_data['ldap_user_name']}", + account=rf"{ad_data['workgroup']}\{ad_data['ldap_user_name']}", account_password=ad_data['ldap_user_passwd'], base_dn=ad_data['base_dn'], groups_base=ad_data['group_base_dn'], diff --git a/tests/foreman/api/test_settings.py b/tests/foreman/api/test_settings.py index 4cbb5609bd0..aaae44def82 100644 --- a/tests/foreman/api/test_settings.py +++ b/tests/foreman/api/test_settings.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random import pytest diff --git a/tests/foreman/api/test_subnet.py b/tests/foreman/api/test_subnet.py index b4882116f8e..826635027a6 100644 --- a/tests/foreman/api/test_subnet.py +++ b/tests/foreman/api/test_subnet.py @@ -16,6 +16,7 @@ :CaseImportance: High """ + import re import pytest diff --git a/tests/foreman/api/test_subscription.py b/tests/foreman/api/test_subscription.py index 282dac528b0..019815bba22 100644 --- a/tests/foreman/api/test_subscription.py +++ b/tests/foreman/api/test_subscription.py @@ -15,6 +15,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string from nailgun.config import ServerConfig from nailgun.entity_mixins import TaskFailedError diff --git a/tests/foreman/api/test_syncplan.py b/tests/foreman/api/test_syncplan.py index 576ad88802f..6acfd5c6117 100644 --- a/tests/foreman/api/test_syncplan.py +++ b/tests/foreman/api/test_syncplan.py @@ -15,6 +15,7 @@ :CaseImportance: High """ + from datetime import datetime, timedelta from time import sleep diff --git a/tests/foreman/api/test_template_combination.py b/tests/foreman/api/test_template_combination.py index 7e9d5f11be8..8575d2ee3c2 100644 --- a/tests/foreman/api/test_template_combination.py +++ b/tests/foreman/api/test_template_combination.py @@ -9,6 +9,7 @@ :Team: Rocket """ + import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/api/test_templatesync.py b/tests/foreman/api/test_templatesync.py index bda401ef373..c19a932cece 100644 --- a/tests/foreman/api/test_templatesync.py +++ b/tests/foreman/api/test_templatesync.py @@ -9,6 +9,7 @@ :Team: Endeavour """ + import base64 import json import time diff --git a/tests/foreman/api/test_user.py b/tests/foreman/api/test_user.py index 75dd19e6f55..7c913ae3f43 100644 --- a/tests/foreman/api/test_user.py +++ b/tests/foreman/api/test_user.py @@ -15,6 +15,7 @@ :CaseImportance: High """ + import json import re @@ -667,7 +668,7 @@ def create_ldap(self, ad_data, module_target_sat): ldap_user_passwd=ad_data['ldap_user_passwd'], authsource=module_target_sat.api.AuthSourceLDAP( onthefly_register=True, - account=fr"{ad_data['workgroup']}\{ad_data['ldap_user_name']}", + account=rf"{ad_data['workgroup']}\{ad_data['ldap_user_name']}", account_password=ad_data['ldap_user_passwd'], base_dn=ad_data['base_dn'], groups_base=ad_data['group_base_dn'], diff --git a/tests/foreman/api/test_usergroup.py b/tests/foreman/api/test_usergroup.py index 95d1547934f..8c51419d92d 100644 --- a/tests/foreman/api/test_usergroup.py +++ b/tests/foreman/api/test_usergroup.py @@ -14,6 +14,7 @@ :CaseImportance: High """ + from random import randint from fauxfactory import gen_string diff --git a/tests/foreman/api/test_webhook.py b/tests/foreman/api/test_webhook.py index 5691a6011de..ca068fd36d8 100644 --- a/tests/foreman/api/test_webhook.py +++ b/tests/foreman/api/test_webhook.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import re import pytest diff --git a/tests/foreman/cli/test_abrt.py b/tests/foreman/cli/test_abrt.py index 0543679b733..2c223476f8f 100644 --- a/tests/foreman/cli/test_abrt.py +++ b/tests/foreman/cli/test_abrt.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest pytestmark = [pytest.mark.stubbed] diff --git a/tests/foreman/cli/test_acs.py b/tests/foreman/cli/test_acs.py index f7ad33cf204..50c82d69443 100644 --- a/tests/foreman/cli/test_acs.py +++ b/tests/foreman/cli/test_acs.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_alphanumeric import pytest diff --git a/tests/foreman/cli/test_activationkey.py b/tests/foreman/cli/test_activationkey.py index 409525d33e9..e6c97afc6af 100644 --- a/tests/foreman/cli/test_activationkey.py +++ b/tests/foreman/cli/test_activationkey.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from random import choice import re diff --git a/tests/foreman/cli/test_ansible.py b/tests/foreman/cli/test_ansible.py index 707acbcfec9..3bc5872dacd 100644 --- a/tests/foreman/cli/test_ansible.py +++ b/tests/foreman/cli/test_ansible.py @@ -8,6 +8,7 @@ :CaseImportance: High """ + from time import sleep from fauxfactory import gen_string diff --git a/tests/foreman/cli/test_architecture.py b/tests/foreman/cli/test_architecture.py index 7578fe577b6..51959e2a9a8 100644 --- a/tests/foreman/cli/test_architecture.py +++ b/tests/foreman/cli/test_architecture.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_choice import pytest diff --git a/tests/foreman/cli/test_auth.py b/tests/foreman/cli/test_auth.py index bf81a87413d..496fe7d646d 100644 --- a/tests/foreman/cli/test_auth.py +++ b/tests/foreman/cli/test_auth.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + from time import sleep from fauxfactory import gen_string @@ -29,9 +30,7 @@ def configure_sessions(satellite, enable=True, add_default_creds=False): """Enables the `use_sessions` option in hammer config""" result = satellite.execute( '''sed -i -e '/username/d;/password/d;/use_sessions/d' {0};\ - echo ' :use_sessions: {1}' >> {0}'''.format( - HAMMER_CONFIG, 'true' if enable else 'false' - ) + echo ' :use_sessions: {1}' >> {0}'''.format(HAMMER_CONFIG, 'true' if enable else 'false') ) if result.status == 0 and add_default_creds: result = satellite.execute( diff --git a/tests/foreman/cli/test_bootdisk.py b/tests/foreman/cli/test_bootdisk.py index e3e767b9ff7..9a2e1e4a987 100644 --- a/tests/foreman/cli/test_bootdisk.py +++ b/tests/foreman/cli/test_bootdisk.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_mac, gen_string import pytest diff --git a/tests/foreman/cli/test_bootstrap_script.py b/tests/foreman/cli/test_bootstrap_script.py index f4b71c24bd1..65872032d1d 100644 --- a/tests/foreman/cli/test_bootstrap_script.py +++ b/tests/foreman/cli/test_bootstrap_script.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest diff --git a/tests/foreman/cli/test_capsule.py b/tests/foreman/cli/test_capsule.py index ddcc100326a..3f7e98b104d 100644 --- a/tests/foreman/cli/test_capsule.py +++ b/tests/foreman/cli/test_capsule.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest pytestmark = [pytest.mark.run_in_one_thread] diff --git a/tests/foreman/cli/test_classparameters.py b/tests/foreman/cli/test_classparameters.py index 022ceed0aac..f6b0ca7a4ee 100644 --- a/tests/foreman/cli/test_classparameters.py +++ b/tests/foreman/cli/test_classparameters.py @@ -11,6 +11,7 @@ :Team: Rocket """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/cli/test_computeresource_azurerm.py b/tests/foreman/cli/test_computeresource_azurerm.py index 1756a0ed674..1c64a55c5bc 100644 --- a/tests/foreman/cli/test_computeresource_azurerm.py +++ b/tests/foreman/cli/test_computeresource_azurerm.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest @@ -343,8 +344,9 @@ def class_host_ft( Provisions the host on AzureRM using Finish template Later in tests this host will be used to perform assertions """ - with sat_azure.hammer_api_timeout(), sat_azure.skip_yum_update_during_provisioning( - template='Kickstart default finish' + with ( + sat_azure.hammer_api_timeout(), + sat_azure.skip_yum_update_during_provisioning(template='Kickstart default finish'), ): host = sat_azure.cli.Host.create( { @@ -472,8 +474,9 @@ def class_host_ud( Provisions the host on AzureRM using UserData template Later in tests this host will be used to perform assertions """ - with sat_azure.hammer_api_timeout(), sat_azure.skip_yum_update_during_provisioning( - template='Kickstart default user data' + with ( + sat_azure.hammer_api_timeout(), + sat_azure.skip_yum_update_during_provisioning(template='Kickstart default user data'), ): host = sat_azure.cli.Host.create( { diff --git a/tests/foreman/cli/test_computeresource_ec2.py b/tests/foreman/cli/test_computeresource_ec2.py index e4e1e669e6b..36c128bdee0 100644 --- a/tests/foreman/cli/test_computeresource_ec2.py +++ b/tests/foreman/cli/test_computeresource_ec2.py @@ -8,6 +8,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/cli/test_computeresource_libvirt.py b/tests/foreman/cli/test_computeresource_libvirt.py index 2a4720750a0..656a8ed32ca 100644 --- a/tests/foreman/cli/test_computeresource_libvirt.py +++ b/tests/foreman/cli/test_computeresource_libvirt.py @@ -28,6 +28,7 @@ :CaseImportance: High """ + import random from fauxfactory import gen_string, gen_url diff --git a/tests/foreman/cli/test_computeresource_osp.py b/tests/foreman/cli/test_computeresource_osp.py index ff6779056ae..1b80cae877f 100644 --- a/tests/foreman/cli/test_computeresource_osp.py +++ b/tests/foreman/cli/test_computeresource_osp.py @@ -10,6 +10,7 @@ :CaseImportance: High """ + from box import Box from fauxfactory import gen_string import pytest diff --git a/tests/foreman/cli/test_computeresource_rhev.py b/tests/foreman/cli/test_computeresource_rhev.py index 173b9c1c414..9e93125eb6b 100644 --- a/tests/foreman/cli/test_computeresource_rhev.py +++ b/tests/foreman/cli/test_computeresource_rhev.py @@ -10,6 +10,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest from wait_for import wait_for diff --git a/tests/foreman/cli/test_computeresource_vmware.py b/tests/foreman/cli/test_computeresource_vmware.py index b72a5fca5c5..1960f0307cd 100644 --- a/tests/foreman/cli/test_computeresource_vmware.py +++ b/tests/foreman/cli/test_computeresource_vmware.py @@ -10,6 +10,7 @@ :CaseAutomation: Automated """ + from fauxfactory import gen_string import pytest from wait_for import wait_for diff --git a/tests/foreman/cli/test_container_management.py b/tests/foreman/cli/test_container_management.py index 17d0b0b4bd0..871993090ed 100644 --- a/tests/foreman/cli/test_container_management.py +++ b/tests/foreman/cli/test_container_management.py @@ -9,6 +9,7 @@ :CaseComponent: ContainerManagement-Content """ + from fauxfactory import gen_string import pytest from wait_for import wait_for diff --git a/tests/foreman/cli/test_contentaccess.py b/tests/foreman/cli/test_contentaccess.py index 0c59e5c70e6..5eefd3af5b0 100644 --- a/tests/foreman/cli/test_contentaccess.py +++ b/tests/foreman/cli/test_contentaccess.py @@ -9,6 +9,7 @@ :team: Phoenix-subscriptions """ + import time from nailgun import entities diff --git a/tests/foreman/cli/test_contentcredentials.py b/tests/foreman/cli/test_contentcredentials.py index 208812cb857..14d4ff50718 100644 --- a/tests/foreman/cli/test_contentcredentials.py +++ b/tests/foreman/cli/test_contentcredentials.py @@ -13,6 +13,7 @@ :CaseImportance: High """ + from tempfile import mkstemp from fauxfactory import gen_alphanumeric, gen_choice, gen_integer, gen_string diff --git a/tests/foreman/cli/test_contentview.py b/tests/foreman/cli/test_contentview.py index a6a36d2947e..f9b6c62221d 100644 --- a/tests/foreman/cli/test_contentview.py +++ b/tests/foreman/cli/test_contentview.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from fauxfactory import gen_alphanumeric, gen_string diff --git a/tests/foreman/cli/test_contentviewfilter.py b/tests/foreman/cli/test_contentviewfilter.py index faf28c42def..34542e6332f 100644 --- a/tests/foreman/cli/test_contentviewfilter.py +++ b/tests/foreman/cli/test_contentviewfilter.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/cli/test_discoveredhost.py b/tests/foreman/cli/test_discoveredhost.py index e578f35e1ac..4c81335e2af 100644 --- a/tests/foreman/cli/test_discoveredhost.py +++ b/tests/foreman/cli/test_discoveredhost.py @@ -9,6 +9,7 @@ :Team: Rocket """ + import pytest from wait_for import wait_for diff --git a/tests/foreman/cli/test_discoveryrule.py b/tests/foreman/cli/test_discoveryrule.py index 2d9059f196b..933b68538aa 100644 --- a/tests/foreman/cli/test_discoveryrule.py +++ b/tests/foreman/cli/test_discoveryrule.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from functools import partial import random diff --git a/tests/foreman/cli/test_docker.py b/tests/foreman/cli/test_docker.py index 10b1d1dd4fc..30f96d9212b 100644 --- a/tests/foreman/cli/test_docker.py +++ b/tests/foreman/cli/test_docker.py @@ -7,6 +7,7 @@ :CaseImportance: High """ + from random import choice, randint from fauxfactory import gen_string, gen_url diff --git a/tests/foreman/cli/test_domain.py b/tests/foreman/cli/test_domain.py index 32f81369592..d77829e3039 100644 --- a/tests/foreman/cli/test_domain.py +++ b/tests/foreman/cli/test_domain.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/cli/test_environment.py b/tests/foreman/cli/test_environment.py index 90e5b79e72a..422030f6af4 100644 --- a/tests/foreman/cli/test_environment.py +++ b/tests/foreman/cli/test_environment.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + from random import choice from fauxfactory import gen_alphanumeric, gen_string diff --git a/tests/foreman/cli/test_errata.py b/tests/foreman/cli/test_errata.py index 3f5047a5781..4f26e58ca6f 100644 --- a/tests/foreman/cli/test_errata.py +++ b/tests/foreman/cli/test_errata.py @@ -10,6 +10,7 @@ :CaseImportance: High """ + from datetime import date, datetime, timedelta from operator import itemgetter diff --git a/tests/foreman/cli/test_fact.py b/tests/foreman/cli/test_fact.py index ddaaa477944..7913d68287c 100644 --- a/tests/foreman/cli/test_fact.py +++ b/tests/foreman/cli/test_fact.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/cli/test_filter.py b/tests/foreman/cli/test_filter.py index 4108ce07d6b..3f05953d6ce 100644 --- a/tests/foreman/cli/test_filter.py +++ b/tests/foreman/cli/test_filter.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.exceptions import CLIReturnCodeError diff --git a/tests/foreman/cli/test_foremantask.py b/tests/foreman/cli/test_foremantask.py index bdce6e63a97..da49b88a289 100644 --- a/tests/foreman/cli/test_foremantask.py +++ b/tests/foreman/cli/test_foremantask.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest diff --git a/tests/foreman/cli/test_globalparam.py b/tests/foreman/cli/test_globalparam.py index 41bb8ca769b..6c1eaed9c07 100644 --- a/tests/foreman/cli/test_globalparam.py +++ b/tests/foreman/cli/test_globalparam.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + from functools import partial from fauxfactory import gen_string diff --git a/tests/foreman/cli/test_hammer.py b/tests/foreman/cli/test_hammer.py index 54a35f833c1..2f324bd638f 100644 --- a/tests/foreman/cli/test_hammer.py +++ b/tests/foreman/cli/test_hammer.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import io import json import re diff --git a/tests/foreman/cli/test_host.py b/tests/foreman/cli/test_host.py index 47b30418dd8..1c96b5a3809 100644 --- a/tests/foreman/cli/test_host.py +++ b/tests/foreman/cli/test_host.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from random import choice import re diff --git a/tests/foreman/cli/test_hostcollection.py b/tests/foreman/cli/test_hostcollection.py index ce3426030b5..e01238e440b 100644 --- a/tests/foreman/cli/test_hostcollection.py +++ b/tests/foreman/cli/test_hostcollection.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from broker import Broker from fauxfactory import gen_string import pytest diff --git a/tests/foreman/cli/test_hostgroup.py b/tests/foreman/cli/test_hostgroup.py index c42356a4478..3a310dfcc81 100644 --- a/tests/foreman/cli/test_hostgroup.py +++ b/tests/foreman/cli/test_hostgroup.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_integer from nailgun import entities import pytest diff --git a/tests/foreman/cli/test_http_proxy.py b/tests/foreman/cli/test_http_proxy.py index 68ea95559ca..bc7e07b0cd1 100644 --- a/tests/foreman/cli/test_http_proxy.py +++ b/tests/foreman/cli/test_http_proxy.py @@ -11,6 +11,7 @@ :CaseAutomation: Automated """ + from fauxfactory import gen_integer, gen_string, gen_url import pytest diff --git a/tests/foreman/cli/test_installer.py b/tests/foreman/cli/test_installer.py index b7601ccde84..738cc4888f8 100644 --- a/tests/foreman/cli/test_installer.py +++ b/tests/foreman/cli/test_installer.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest pytestmark = [pytest.mark.stubbed] diff --git a/tests/foreman/cli/test_jobtemplate.py b/tests/foreman/cli/test_jobtemplate.py index 66553d2c54d..8fb80120384 100644 --- a/tests/foreman/cli/test_jobtemplate.py +++ b/tests/foreman/cli/test_jobtemplate.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/cli/test_ldapauthsource.py b/tests/foreman/cli/test_ldapauthsource.py index ce7b625c3a6..f43539161bf 100644 --- a/tests/foreman/cli/test_ldapauthsource.py +++ b/tests/foreman/cli/test_ldapauthsource.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string from nailgun import entities import pytest @@ -113,7 +114,7 @@ def test_positive_refresh_usergroup_with_ad(self, member_group, ad_data, module_ 'attr-firstname': LDAP_ATTR['firstname'], 'attr-lastname': LDAP_ATTR['surname'], 'attr-mail': LDAP_ATTR['mail'], - 'account': fr"{ad_data['workgroup']}\{ad_data['ldap_user_name']}", + 'account': rf"{ad_data['workgroup']}\{ad_data['ldap_user_name']}", 'account-password': ad_data['ldap_user_passwd'], 'base-dn': ad_data['base_dn'], } diff --git a/tests/foreman/cli/test_leapp_client.py b/tests/foreman/cli/test_leapp_client.py index 4ea36bbf37a..7eb11f414e7 100644 --- a/tests/foreman/cli/test_leapp_client.py +++ b/tests/foreman/cli/test_leapp_client.py @@ -11,6 +11,7 @@ :CaseAutomation: Automated """ + from broker import Broker import pytest diff --git a/tests/foreman/cli/test_lifecycleenvironment.py b/tests/foreman/cli/test_lifecycleenvironment.py index 75bf12c681b..294753e04e8 100644 --- a/tests/foreman/cli/test_lifecycleenvironment.py +++ b/tests/foreman/cli/test_lifecycleenvironment.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from math import ceil from fauxfactory import gen_string diff --git a/tests/foreman/cli/test_location.py b/tests/foreman/cli/test_location.py index c5ca06a7032..c57c067bd58 100644 --- a/tests/foreman/cli/test_location.py +++ b/tests/foreman/cli/test_location.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/cli/test_logging.py b/tests/foreman/cli/test_logging.py index 8d315b3e59c..620f2f0cceb 100644 --- a/tests/foreman/cli/test_logging.py +++ b/tests/foreman/cli/test_logging.py @@ -11,6 +11,7 @@ :CaseImportance: Medium """ + import re from fauxfactory import gen_string @@ -243,7 +244,7 @@ def test_positive_logging_from_pulp3(module_org, target_sat): target_sat.cli.Repository.synchronize({'id': repo['id']}) # Get the id of repository sync from task task_out = target_sat.execute( - "hammer task list | grep -F \'Synchronize repository {\"text\"=>\"repository\'" + "hammer task list | grep -F 'Synchronize repository {\"text\"=>\"repository'" ).stdout.splitlines()[0][:8] prod_log_out = target_sat.execute(f'grep {task_out} {source_log}').stdout.splitlines()[0] # Get correlation id of pulp from production logs diff --git a/tests/foreman/cli/test_medium.py b/tests/foreman/cli/test_medium.py index 26017b415ab..3e3b037ba2d 100644 --- a/tests/foreman/cli/test_medium.py +++ b/tests/foreman/cli/test_medium.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_alphanumeric import pytest diff --git a/tests/foreman/cli/test_model.py b/tests/foreman/cli/test_model.py index 8fc51be9f62..f60a6c59fc6 100644 --- a/tests/foreman/cli/test_model.py +++ b/tests/foreman/cli/test_model.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest @@ -37,7 +38,7 @@ def class_model(self, target_sat): ('name', 'new_name'), **parametrized( list(zip(valid_data_list().values(), valid_data_list().values(), strict=True)) - ) + ), ) def test_positive_crud_with_name(self, name, new_name, module_target_sat): """Successfully creates, updates and deletes a Model. diff --git a/tests/foreman/cli/test_operatingsystem.py b/tests/foreman/cli/test_operatingsystem.py index 48ed8af8099..615ffb9990f 100644 --- a/tests/foreman/cli/test_operatingsystem.py +++ b/tests/foreman/cli/test_operatingsystem.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_alphanumeric, gen_string import pytest diff --git a/tests/foreman/cli/test_organization.py b/tests/foreman/cli/test_organization.py index 2d4d3714696..a35754d87b6 100644 --- a/tests/foreman/cli/test_organization.py +++ b/tests/foreman/cli/test_organization.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/cli/test_oscap.py b/tests/foreman/cli/test_oscap.py index ecbc50f06de..de369dd5cc7 100644 --- a/tests/foreman/cli/test_oscap.py +++ b/tests/foreman/cli/test_oscap.py @@ -11,6 +11,7 @@ :CaseAutomation: Automated """ + from fauxfactory import gen_string from nailgun import entities import pytest diff --git a/tests/foreman/cli/test_oscap_tailoringfiles.py b/tests/foreman/cli/test_oscap_tailoringfiles.py index e95cfb2891a..127ba051e40 100644 --- a/tests/foreman/cli/test_oscap_tailoringfiles.py +++ b/tests/foreman/cli/test_oscap_tailoringfiles.py @@ -11,6 +11,7 @@ :CaseAutomation: Automated """ + from fauxfactory import gen_string import pytest @@ -185,7 +186,6 @@ def test_negative_associate_tailoring_file_with_different_scap(self): @pytest.mark.skip_if_open("BZ:1857572") @pytest.mark.tier2 def test_positive_download_tailoring_file(self, tailoring_file_path, target_sat): - """Download the tailoring file from satellite :id: 75d8c810-19a7-4285-bc3a-a1fb1a0e9088 diff --git a/tests/foreman/cli/test_ostreebranch.py b/tests/foreman/cli/test_ostreebranch.py index d768b3f2d70..0d885528a04 100644 --- a/tests/foreman/cli/test_ostreebranch.py +++ b/tests/foreman/cli/test_ostreebranch.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from nailgun import entities diff --git a/tests/foreman/cli/test_partitiontable.py b/tests/foreman/cli/test_partitiontable.py index 51764ac8f0a..e89af27e163 100644 --- a/tests/foreman/cli/test_partitiontable.py +++ b/tests/foreman/cli/test_partitiontable.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from random import randint from fauxfactory import gen_string diff --git a/tests/foreman/cli/test_ping.py b/tests/foreman/cli/test_ping.py index 0a288143233..1a1471d5d2f 100644 --- a/tests/foreman/cli/test_ping.py +++ b/tests/foreman/cli/test_ping.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest pytestmark = [pytest.mark.tier1, pytest.mark.upgrade] diff --git a/tests/foreman/cli/test_product.py b/tests/foreman/cli/test_product.py index 3d413209db3..ec81348a850 100644 --- a/tests/foreman/cli/test_product.py +++ b/tests/foreman/cli/test_product.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_alphanumeric, gen_integer, gen_string, gen_url import pytest diff --git a/tests/foreman/cli/test_provisioning.py b/tests/foreman/cli/test_provisioning.py index 1c7799edc53..21f937dac24 100644 --- a/tests/foreman/cli/test_provisioning.py +++ b/tests/foreman/cli/test_provisioning.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest diff --git a/tests/foreman/cli/test_provisioningtemplate.py b/tests/foreman/cli/test_provisioningtemplate.py index 59aabc2d2c4..a27b6fe534d 100644 --- a/tests/foreman/cli/test_provisioningtemplate.py +++ b/tests/foreman/cli/test_provisioningtemplate.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from random import randint diff --git a/tests/foreman/cli/test_puppetclass.py b/tests/foreman/cli/test_puppetclass.py index 3a8b50856bb..a3dcd8837f9 100644 --- a/tests/foreman/cli/test_puppetclass.py +++ b/tests/foreman/cli/test_puppetclass.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/cli/test_realm.py b/tests/foreman/cli/test_realm.py index c05dc1291f8..4cae5e847b9 100644 --- a/tests/foreman/cli/test_realm.py +++ b/tests/foreman/cli/test_realm.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from fauxfactory import gen_string diff --git a/tests/foreman/cli/test_registration.py b/tests/foreman/cli/test_registration.py index cbec236bae1..2eadf114110 100644 --- a/tests/foreman/cli/test_registration.py +++ b/tests/foreman/cli/test_registration.py @@ -11,6 +11,7 @@ :Team: Rocket """ + import re from fauxfactory import gen_string diff --git a/tests/foreman/cli/test_remoteexecution.py b/tests/foreman/cli/test_remoteexecution.py index 86c4a5a267f..133348f2902 100644 --- a/tests/foreman/cli/test_remoteexecution.py +++ b/tests/foreman/cli/test_remoteexecution.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime, timedelta from time import sleep diff --git a/tests/foreman/cli/test_report.py b/tests/foreman/cli/test_report.py index ea4f14371bb..588346f9431 100644 --- a/tests/foreman/cli/test_report.py +++ b/tests/foreman/cli/test_report.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import random import pytest diff --git a/tests/foreman/cli/test_reporttemplates.py b/tests/foreman/cli/test_reporttemplates.py index 64c35117180..0e3f92cf56e 100644 --- a/tests/foreman/cli/test_reporttemplates.py +++ b/tests/foreman/cli/test_reporttemplates.py @@ -10,6 +10,7 @@ :CaseImportance: High """ + from broker import Broker from fauxfactory import gen_alpha import pytest diff --git a/tests/foreman/cli/test_repositories.py b/tests/foreman/cli/test_repositories.py index a4d86b3fe44..692e9519ca9 100644 --- a/tests/foreman/cli/test_repositories.py +++ b/tests/foreman/cli/test_repositories.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest from requests.exceptions import HTTPError diff --git a/tests/foreman/cli/test_repository.py b/tests/foreman/cli/test_repository.py index 5d408e8b46d..1750b85d21b 100644 --- a/tests/foreman/cli/test_repository.py +++ b/tests/foreman/cli/test_repository.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from random import choice from string import punctuation diff --git a/tests/foreman/cli/test_repository_set.py b/tests/foreman/cli/test_repository_set.py index 092034c6dc8..71d7d091493 100644 --- a/tests/foreman/cli/test_repository_set.py +++ b/tests/foreman/cli/test_repository_set.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.constants import PRDS, REPOSET diff --git a/tests/foreman/cli/test_rhcloud_inventory.py b/tests/foreman/cli/test_rhcloud_inventory.py index 10b27b48206..7916425d08a 100644 --- a/tests/foreman/cli/test_rhcloud_inventory.py +++ b/tests/foreman/cli/test_rhcloud_inventory.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime import time diff --git a/tests/foreman/cli/test_role.py b/tests/foreman/cli/test_role.py index 7ccdafdf4f1..6e16e0f0759 100644 --- a/tests/foreman/cli/test_role.py +++ b/tests/foreman/cli/test_role.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from math import ceil from random import choice import re diff --git a/tests/foreman/cli/test_satellitesync.py b/tests/foreman/cli/test_satellitesync.py index 1391b895334..14baf3f65ba 100644 --- a/tests/foreman/cli/test_satellitesync.py +++ b/tests/foreman/cli/test_satellitesync.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import os from time import sleep diff --git a/tests/foreman/cli/test_settings.py b/tests/foreman/cli/test_settings.py index fdd005e02e8..3c8f37461cb 100644 --- a/tests/foreman/cli/test_settings.py +++ b/tests/foreman/cli/test_settings.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from time import sleep diff --git a/tests/foreman/cli/test_sso.py b/tests/foreman/cli/test_sso.py index 949e021ff48..e24b847ed73 100644 --- a/tests/foreman/cli/test_sso.py +++ b/tests/foreman/cli/test_sso.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest pytestmark = [pytest.mark.stubbed, pytest.mark.upgrade] diff --git a/tests/foreman/cli/test_subnet.py b/tests/foreman/cli/test_subnet.py index 74a6e1727fc..c7daca3bb27 100644 --- a/tests/foreman/cli/test_subnet.py +++ b/tests/foreman/cli/test_subnet.py @@ -11,6 +11,7 @@ :CaseImportance: Medium """ + import random import re diff --git a/tests/foreman/cli/test_subscription.py b/tests/foreman/cli/test_subscription.py index a7a74f4360c..555dce75923 100644 --- a/tests/foreman/cli/test_subscription.py +++ b/tests/foreman/cli/test_subscription.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string from nailgun import entities import pytest diff --git a/tests/foreman/cli/test_syncplan.py b/tests/foreman/cli/test_syncplan.py index 8669cd49a18..4569fd5aa61 100644 --- a/tests/foreman/cli/test_syncplan.py +++ b/tests/foreman/cli/test_syncplan.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime, timedelta from time import sleep diff --git a/tests/foreman/cli/test_templatesync.py b/tests/foreman/cli/test_templatesync.py index 168090e0c98..de0f3101396 100644 --- a/tests/foreman/cli/test_templatesync.py +++ b/tests/foreman/cli/test_templatesync.py @@ -9,6 +9,7 @@ :Team: Endeavour """ + import base64 from fauxfactory import gen_string diff --git a/tests/foreman/cli/test_user.py b/tests/foreman/cli/test_user.py index b334a7184ca..09296a27bdf 100644 --- a/tests/foreman/cli/test_user.py +++ b/tests/foreman/cli/test_user.py @@ -17,6 +17,7 @@ :CaseImportance: High """ + import datetime import random from time import sleep diff --git a/tests/foreman/cli/test_usergroup.py b/tests/foreman/cli/test_usergroup.py index 1c757b4e766..5ad9106a6fc 100644 --- a/tests/foreman/cli/test_usergroup.py +++ b/tests/foreman/cli/test_usergroup.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random import pytest diff --git a/tests/foreman/cli/test_vm_install_products_package.py b/tests/foreman/cli/test_vm_install_products_package.py index f03fc19e997..e64f98aaaf8 100644 --- a/tests/foreman/cli/test_vm_install_products_package.py +++ b/tests/foreman/cli/test_vm_install_products_package.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from broker import Broker import pytest diff --git a/tests/foreman/cli/test_webhook.py b/tests/foreman/cli/test_webhook.py index 2849b6aa57d..b981f01f8b1 100644 --- a/tests/foreman/cli/test_webhook.py +++ b/tests/foreman/cli/test_webhook.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from functools import partial from random import choice diff --git a/tests/foreman/destructive/test_ansible.py b/tests/foreman/destructive/test_ansible.py index b57ba89c58f..28f6e932099 100644 --- a/tests/foreman/destructive/test_ansible.py +++ b/tests/foreman/destructive/test_ansible.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest pytestmark = [pytest.mark.destructive, pytest.mark.upgrade] diff --git a/tests/foreman/destructive/test_auth.py b/tests/foreman/destructive/test_auth.py index 95da3c5ccce..ed8dbc41d47 100644 --- a/tests/foreman/destructive/test_auth.py +++ b/tests/foreman/destructive/test_auth.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/destructive/test_capsule.py b/tests/foreman/destructive/test_capsule.py index 1cc63f4fbbe..9d3ce22b420 100644 --- a/tests/foreman/destructive/test_capsule.py +++ b/tests/foreman/destructive/test_capsule.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/destructive/test_capsule_loadbalancer.py b/tests/foreman/destructive/test_capsule_loadbalancer.py index 909a3f08ddb..3290b1ceb59 100644 --- a/tests/foreman/destructive/test_capsule_loadbalancer.py +++ b/tests/foreman/destructive/test_capsule_loadbalancer.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from wrapanapi import VmState diff --git a/tests/foreman/destructive/test_capsulecontent.py b/tests/foreman/destructive/test_capsulecontent.py index 12f3455c08d..d165b6ea841 100644 --- a/tests/foreman/destructive/test_capsulecontent.py +++ b/tests/foreman/destructive/test_capsulecontent.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from box import Box from fauxfactory import gen_alpha import pytest diff --git a/tests/foreman/destructive/test_clone.py b/tests/foreman/destructive/test_clone.py index f5f75dcd1a1..a7b786945e2 100644 --- a/tests/foreman/destructive/test_clone.py +++ b/tests/foreman/destructive/test_clone.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo import constants diff --git a/tests/foreman/destructive/test_contenthost.py b/tests/foreman/destructive/test_contenthost.py index 4568dbfd6b8..283d1636014 100644 --- a/tests/foreman/destructive/test_contenthost.py +++ b/tests/foreman/destructive/test_contenthost.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/destructive/test_contentview.py b/tests/foreman/destructive/test_contentview.py index 03af433a939..c27275b653a 100644 --- a/tests/foreman/destructive/test_contentview.py +++ b/tests/foreman/destructive/test_contentview.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from nailgun.entity_mixins import TaskFailedError import pytest diff --git a/tests/foreman/destructive/test_discoveredhost.py b/tests/foreman/destructive/test_discoveredhost.py index 8034957ec72..86568230e0d 100644 --- a/tests/foreman/destructive/test_discoveredhost.py +++ b/tests/foreman/destructive/test_discoveredhost.py @@ -9,6 +9,7 @@ :CaseAutomation: Automated """ + from copy import copy import re diff --git a/tests/foreman/destructive/test_foreman_rake.py b/tests/foreman/destructive/test_foreman_rake.py index 5162fa94be2..1cbc67a7b20 100644 --- a/tests/foreman/destructive/test_foreman_rake.py +++ b/tests/foreman/destructive/test_foreman_rake.py @@ -11,6 +11,7 @@ :Team: Endeavour """ + import pytest pytestmark = pytest.mark.destructive diff --git a/tests/foreman/destructive/test_foreman_service.py b/tests/foreman/destructive/test_foreman_service.py index 6d0d24de110..fc033cd2965 100644 --- a/tests/foreman/destructive/test_foreman_service.py +++ b/tests/foreman/destructive/test_foreman_service.py @@ -7,6 +7,7 @@ :CaseImportance: Medium """ + import pytest from robottelo.constants import DEFAULT_ORG diff --git a/tests/foreman/destructive/test_host.py b/tests/foreman/destructive/test_host.py index bab00e5acab..4a8ae350f39 100644 --- a/tests/foreman/destructive/test_host.py +++ b/tests/foreman/destructive/test_host.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from airgun.exceptions import NoSuchElementException import pytest diff --git a/tests/foreman/destructive/test_infoblox.py b/tests/foreman/destructive/test_infoblox.py index 52e26830b14..3038cbee083 100644 --- a/tests/foreman/destructive/test_infoblox.py +++ b/tests/foreman/destructive/test_infoblox.py @@ -9,6 +9,7 @@ :CaseImportance: High """ + from fauxfactory import gen_mac, gen_string import pytest import requests diff --git a/tests/foreman/destructive/test_installer.py b/tests/foreman/destructive/test_installer.py index 46c5e908810..525527c0f37 100644 --- a/tests/foreman/destructive/test_installer.py +++ b/tests/foreman/destructive/test_installer.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import random from fauxfactory import gen_domain, gen_string diff --git a/tests/foreman/destructive/test_katello_agent.py b/tests/foreman/destructive/test_katello_agent.py index cb22bb18f2b..065a58c7c93 100644 --- a/tests/foreman/destructive/test_katello_agent.py +++ b/tests/foreman/destructive/test_katello_agent.py @@ -14,6 +14,7 @@ :Upstream: No """ + import pytest from robottelo import constants diff --git a/tests/foreman/destructive/test_katello_certs_check.py b/tests/foreman/destructive/test_katello_certs_check.py index db133e99749..c05a64d85b4 100644 --- a/tests/foreman/destructive/test_katello_certs_check.py +++ b/tests/foreman/destructive/test_katello_certs_check.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import re import pytest diff --git a/tests/foreman/destructive/test_ldap_authentication.py b/tests/foreman/destructive/test_ldap_authentication.py index 33539fff89e..c5a82bff6fa 100644 --- a/tests/foreman/destructive/test_ldap_authentication.py +++ b/tests/foreman/destructive/test_ldap_authentication.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import os from time import sleep @@ -196,9 +197,12 @@ def test_positive_create_with_https( assert ldap_source['ldap_server']['name'] == ldap_auth_name assert ldap_source['ldap_server']['host'] == auth_data['ldap_hostname'] assert ldap_source['ldap_server']['port'] == '636' - with module_target_sat.ui_session( - test_name, username, auth_data['ldap_user_passwd'] - ) as ldapsession, pytest.raises(NavigationTriesExceeded): + with ( + module_target_sat.ui_session( + test_name, username, auth_data['ldap_user_passwd'] + ) as ldapsession, + pytest.raises(NavigationTriesExceeded), + ): ldapsession.user.search('') assert module_target_sat.api.User().search(query={'search': f'login="{username}"'}) diff --git a/tests/foreman/destructive/test_ldapauthsource.py b/tests/foreman/destructive/test_ldapauthsource.py index 0cebd782532..1b6aeec2701 100644 --- a/tests/foreman/destructive/test_ldapauthsource.py +++ b/tests/foreman/destructive/test_ldapauthsource.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from time import sleep import pytest diff --git a/tests/foreman/destructive/test_leapp_satellite.py b/tests/foreman/destructive/test_leapp_satellite.py index 4e9b269c4e6..a94b1f3a005 100644 --- a/tests/foreman/destructive/test_leapp_satellite.py +++ b/tests/foreman/destructive/test_leapp_satellite.py @@ -9,6 +9,7 @@ :CaseImportance: High """ + from broker import Broker import pytest diff --git a/tests/foreman/destructive/test_packages.py b/tests/foreman/destructive/test_packages.py index f052948002f..b27065b9a96 100644 --- a/tests/foreman/destructive/test_packages.py +++ b/tests/foreman/destructive/test_packages.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import re import pytest diff --git a/tests/foreman/destructive/test_ping.py b/tests/foreman/destructive/test_ping.py index 96ae171c8f7..145ce663be6 100644 --- a/tests/foreman/destructive/test_ping.py +++ b/tests/foreman/destructive/test_ping.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest pytestmark = pytest.mark.destructive diff --git a/tests/foreman/destructive/test_puppetplugin.py b/tests/foreman/destructive/test_puppetplugin.py index 70d82a816ac..1063dce71c9 100644 --- a/tests/foreman/destructive/test_puppetplugin.py +++ b/tests/foreman/destructive/test_puppetplugin.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.constants import PUPPET_CAPSULE_INSTALLER, PUPPET_COMMON_INSTALLER_OPTS diff --git a/tests/foreman/destructive/test_realm.py b/tests/foreman/destructive/test_realm.py index c495e29176e..6b7c0478fd1 100644 --- a/tests/foreman/destructive/test_realm.py +++ b/tests/foreman/destructive/test_realm.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from fauxfactory import gen_string diff --git a/tests/foreman/destructive/test_registration.py b/tests/foreman/destructive/test_registration.py index 9c8dbfa4929..7b4aae79ebf 100644 --- a/tests/foreman/destructive/test_registration.py +++ b/tests/foreman/destructive/test_registration.py @@ -10,6 +10,7 @@ :Team: Rocket """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/destructive/test_remoteexecution.py b/tests/foreman/destructive/test_remoteexecution.py index c9c6bdb8b22..190708153a5 100644 --- a/tests/foreman/destructive/test_remoteexecution.py +++ b/tests/foreman/destructive/test_remoteexecution.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string from nailgun import client from nailgun.entity_mixins import TaskFailedError diff --git a/tests/foreman/destructive/test_rename.py b/tests/foreman/destructive/test_rename.py index 03fd9ff0d6f..8f06cd7a5f8 100644 --- a/tests/foreman/destructive/test_rename.py +++ b/tests/foreman/destructive/test_rename.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/destructive/test_repository.py b/tests/foreman/destructive/test_repository.py index 026134f2017..41c380df2ad 100644 --- a/tests/foreman/destructive/test_repository.py +++ b/tests/foreman/destructive/test_repository.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from nailgun.entity_mixins import TaskFailedError import pytest diff --git a/tests/foreman/endtoend/test_api_endtoend.py b/tests/foreman/endtoend/test_api_endtoend.py index dc7f895ef75..eed7554f72e 100644 --- a/tests/foreman/endtoend/test_api_endtoend.py +++ b/tests/foreman/endtoend/test_api_endtoend.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from collections import defaultdict import http from pprint import pformat diff --git a/tests/foreman/endtoend/test_cli_endtoend.py b/tests/foreman/endtoend/test_cli_endtoend.py index 3a6e59a0975..3a21279a1ed 100644 --- a/tests/foreman/endtoend/test_cli_endtoend.py +++ b/tests/foreman/endtoend/test_cli_endtoend.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_alphanumeric, gen_ipaddr import pytest diff --git a/tests/foreman/installer/test_infoblox.py b/tests/foreman/installer/test_infoblox.py index 5f839d4e850..b17b3db02ab 100644 --- a/tests/foreman/installer/test_infoblox.py +++ b/tests/foreman/installer/test_infoblox.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest diff --git a/tests/foreman/installer/test_installer.py b/tests/foreman/installer/test_installer.py index 06517529746..31b252301c8 100644 --- a/tests/foreman/installer/test_installer.py +++ b/tests/foreman/installer/test_installer.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest from robottelo import ssh diff --git a/tests/foreman/longrun/test_inc_updates.py b/tests/foreman/longrun/test_inc_updates.py index 8ffb84fb36c..cc0d6ef466f 100644 --- a/tests/foreman/longrun/test_inc_updates.py +++ b/tests/foreman/longrun/test_inc_updates.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime, timedelta from nailgun import entities diff --git a/tests/foreman/longrun/test_oscap.py b/tests/foreman/longrun/test_oscap.py index babcf930fb4..e40328ef606 100644 --- a/tests/foreman/longrun/test_oscap.py +++ b/tests/foreman/longrun/test_oscap.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from broker import Broker from fauxfactory import gen_string from nailgun import entities diff --git a/tests/foreman/maintain/test_advanced.py b/tests/foreman/maintain/test_advanced.py index 68b00e5c071..219a22d03da 100644 --- a/tests/foreman/maintain/test_advanced.py +++ b/tests/foreman/maintain/test_advanced.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest import yaml diff --git a/tests/foreman/maintain/test_backup_restore.py b/tests/foreman/maintain/test_backup_restore.py index f81b268e844..0e110b78f1b 100644 --- a/tests/foreman/maintain/test_backup_restore.py +++ b/tests/foreman/maintain/test_backup_restore.py @@ -12,6 +12,7 @@ """ + import re from fauxfactory import gen_string @@ -136,7 +137,7 @@ def test_positive_backup_split_pulp_tar( assert 'FAIL' not in result.stdout # Check for expected files - backup_dir = re.findall(fr'{subdir}\/{instance}-backup-.*-[0-5][0-9]', result.stdout)[0] + backup_dir = re.findall(rf'{subdir}\/{instance}-backup-.*-[0-5][0-9]', result.stdout)[0] files = sat_maintain.execute(f'ls -a {backup_dir}').stdout.split('\n') files = [i for i in files if not re.compile(r'^\.*$').search(i)] @@ -180,7 +181,7 @@ def test_positive_backup_capsule_features( assert 'FAIL' not in result.stdout # Check for expected files - backup_dir = re.findall(fr'{subdir}\/{instance}-backup-.*-[0-5][0-9]', result.stdout)[0] + backup_dir = re.findall(rf'{subdir}\/{instance}-backup-.*-[0-5][0-9]', result.stdout)[0] files = sat_maintain.execute(f'ls -a {backup_dir}').stdout.split('\n') files = [i for i in files if not re.compile(r'^\.*$').search(i)] @@ -215,7 +216,7 @@ def test_positive_backup_all(sat_maintain, setup_backup_tests, module_synced_rep assert result.status == 0 assert 'FAIL' not in result.stdout - init_backup_dir = re.findall(fr'{subdir}\/{instance}-backup-.*-[0-5][0-9]', result.stdout)[0] + init_backup_dir = re.findall(rf'{subdir}\/{instance}-backup-.*-[0-5][0-9]', result.stdout)[0] result = sat_maintain.cli.Backup.run_backup( backup_dir=subdir, @@ -262,7 +263,7 @@ def test_positive_backup_offline_logical(sat_maintain, setup_backup_tests, modul assert 'FAIL' not in result.stdout # Check for expected files - backup_dir = re.findall(fr'{subdir}\/{instance}-backup-.*-[0-5][0-9]', result.stdout)[0] + backup_dir = re.findall(rf'{subdir}\/{instance}-backup-.*-[0-5][0-9]', result.stdout)[0] files = sat_maintain.execute(f'ls -a {backup_dir}').stdout.split('\n') files = [i for i in files if not re.compile(r'^\.*$').search(i)] @@ -435,7 +436,7 @@ def test_positive_puppet_backup_restore( assert 'FAIL' not in result.stdout # Check for expected files - backup_dir = re.findall(fr'{subdir}\/{instance}-backup-.*-[0-5][0-9]', result.stdout)[0] + backup_dir = re.findall(rf'{subdir}\/{instance}-backup-.*-[0-5][0-9]', result.stdout)[0] files = sat_maintain.execute(f'ls -a {backup_dir}').stdout.split('\n') files = [i for i in files if not re.compile(r'^\.*$').search(i)] @@ -521,7 +522,7 @@ def test_positive_backup_restore( assert 'FAIL' not in result.stdout # Check for expected files - backup_dir = re.findall(fr'{subdir}\/{instance}-backup-.*-[0-5][0-9]', result.stdout)[0] + backup_dir = re.findall(rf'{subdir}\/{instance}-backup-.*-[0-5][0-9]', result.stdout)[0] files = sat_maintain.execute(f'ls -a {backup_dir}').stdout.split('\n') files = [i for i in files if not re.compile(r'^\.*$').search(i)] @@ -605,7 +606,7 @@ def test_positive_backup_restore_incremental( assert result.status == 0 assert 'FAIL' not in result.stdout - init_backup_dir = re.findall(fr'{subdir}\/satellite-backup-.*-[0-5][0-9]', result.stdout)[0] + init_backup_dir = re.findall(rf'{subdir}\/satellite-backup-.*-[0-5][0-9]', result.stdout)[0] # create additional content secondary_repo = sat_maintain.api.Repository( @@ -624,7 +625,7 @@ def test_positive_backup_restore_incremental( assert 'FAIL' not in result.stdout # check for expected files - inc_backup_dir = re.findall(fr'{subdir}\/satellite-backup-.*-[0-5][0-9]', result.stdout)[0] + inc_backup_dir = re.findall(rf'{subdir}\/satellite-backup-.*-[0-5][0-9]', result.stdout)[0] files = sat_maintain.execute(f'ls -a {inc_backup_dir}').stdout.split('\n') files = [i for i in files if not re.compile(r'^\.*$').search(i)] diff --git a/tests/foreman/maintain/test_health.py b/tests/foreman/maintain/test_health.py index 672cdde1550..4eca9cea15d 100644 --- a/tests/foreman/maintain/test_health.py +++ b/tests/foreman/maintain/test_health.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import time from fauxfactory import gen_string diff --git a/tests/foreman/maintain/test_maintenance_mode.py b/tests/foreman/maintain/test_maintenance_mode.py index b8d5024e1b1..a405371d516 100644 --- a/tests/foreman/maintain/test_maintenance_mode.py +++ b/tests/foreman/maintain/test_maintenance_mode.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest import yaml diff --git a/tests/foreman/maintain/test_offload_DB.py b/tests/foreman/maintain/test_offload_DB.py index 0e1b3ced9d9..3c069658f98 100644 --- a/tests/foreman/maintain/test_offload_DB.py +++ b/tests/foreman/maintain/test_offload_DB.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/maintain/test_packages.py b/tests/foreman/maintain/test_packages.py index f0ae22d6d10..90483a6971f 100644 --- a/tests/foreman/maintain/test_packages.py +++ b/tests/foreman/maintain/test_packages.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/maintain/test_service.py b/tests/foreman/maintain/test_service.py index 4120309aeae..e03704402c2 100644 --- a/tests/foreman/maintain/test_service.py +++ b/tests/foreman/maintain/test_service.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + from fauxfactory import gen_string import pytest from wait_for import wait_for diff --git a/tests/foreman/maintain/test_upgrade.py b/tests/foreman/maintain/test_upgrade.py index 30e4d11b14c..8d392ab3fad 100644 --- a/tests/foreman/maintain/test_upgrade.py +++ b/tests/foreman/maintain/test_upgrade.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/sanity/test_bvt.py b/tests/foreman/sanity/test_bvt.py index 7da1ccc3d8e..9c37152fa34 100644 --- a/tests/foreman/sanity/test_bvt.py +++ b/tests/foreman/sanity/test_bvt.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import re import pytest diff --git a/tests/foreman/sys/test_dynflow.py b/tests/foreman/sys/test_dynflow.py index e4a913d88c9..d0ae106e938 100644 --- a/tests/foreman/sys/test_dynflow.py +++ b/tests/foreman/sys/test_dynflow.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest diff --git a/tests/foreman/sys/test_fam.py b/tests/foreman/sys/test_fam.py index ebc9d155769..9b56fdfca33 100644 --- a/tests/foreman/sys/test_fam.py +++ b/tests/foreman/sys/test_fam.py @@ -11,6 +11,7 @@ :Team: Platform """ + import pytest from robottelo.constants import FAM_MODULE_PATH, FOREMAN_ANSIBLE_MODULES, RH_SAT_ROLES diff --git a/tests/foreman/sys/test_katello_certs_check.py b/tests/foreman/sys/test_katello_certs_check.py index b330aeeec1b..bf93bc041f2 100644 --- a/tests/foreman/sys/test_katello_certs_check.py +++ b/tests/foreman/sys/test_katello_certs_check.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import re import pytest diff --git a/tests/foreman/sys/test_pulp3_filesystem.py b/tests/foreman/sys/test_pulp3_filesystem.py index ac747ca5f10..a0ab51630af 100644 --- a/tests/foreman/sys/test_pulp3_filesystem.py +++ b/tests/foreman/sys/test_pulp3_filesystem.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime import json diff --git a/tests/foreman/ui/test_activationkey.py b/tests/foreman/ui/test_activationkey.py index 4242b9fdff3..72c7fd2d706 100644 --- a/tests/foreman/ui/test_activationkey.py +++ b/tests/foreman/ui/test_activationkey.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from broker import Broker diff --git a/tests/foreman/ui/test_ansible.py b/tests/foreman/ui/test_ansible.py index 3fa3a4d6838..f681aeff8c4 100644 --- a/tests/foreman/ui/test_ansible.py +++ b/tests/foreman/ui/test_ansible.py @@ -8,6 +8,7 @@ :CaseImportance: Critical """ + from fauxfactory import gen_string import pytest import yaml @@ -181,7 +182,7 @@ def _finalize(): result = rhel_contenthost.execute(command) assert result.status == 0, f'Failed to register host: {result.stderr}' target_host = rhel_contenthost.nailgun_host - default_value = '[\"test\"]' + default_value = '["test"]' parameter_type = 'array' with target_sat.ui_session() as session: session.organization.select(org_name=module_org.name) diff --git a/tests/foreman/ui/test_architecture.py b/tests/foreman/ui/test_architecture.py index 045d7f06cc6..151f860d9b1 100644 --- a/tests/foreman/ui/test_architecture.py +++ b/tests/foreman/ui/test_architecture.py @@ -11,6 +11,7 @@ :CaseImportance: Low """ + from fauxfactory import gen_string from nailgun import entities import pytest diff --git a/tests/foreman/ui/test_audit.py b/tests/foreman/ui/test_audit.py index 373b9f89de3..af7d18adcb0 100644 --- a/tests/foreman/ui/test_audit.py +++ b/tests/foreman/ui/test_audit.py @@ -9,6 +9,7 @@ :Team: Endeavour """ + from fauxfactory import gen_string from nailgun import entities import pytest diff --git a/tests/foreman/ui/test_bookmarks.py b/tests/foreman/ui/test_bookmarks.py index 096f8fdf7cd..0670563ab66 100644 --- a/tests/foreman/ui/test_bookmarks.py +++ b/tests/foreman/ui/test_bookmarks.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from airgun.exceptions import DisabledWidgetError, NoSuchElementException from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_branding.py b/tests/foreman/ui/test_branding.py index 8fe30b1c2ef..0929285af18 100644 --- a/tests/foreman/ui/test_branding.py +++ b/tests/foreman/ui/test_branding.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest diff --git a/tests/foreman/ui/test_computeprofiles.py b/tests/foreman/ui/test_computeprofiles.py index 31075e7c1fb..9c15f1e42ae 100644 --- a/tests/foreman/ui/test_computeprofiles.py +++ b/tests/foreman/ui/test_computeprofiles.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string from nailgun import entities import pytest @@ -36,8 +37,8 @@ def test_positive_end_to_end(session, module_location, module_org): session.computeprofile.create({'name': name}) assert entities.ComputeProfile().search(query={'search': f'name={name}'}), ( - 'Compute profile {} expected to exist, but is not included in the search ' - 'results'.format(name) + f'Compute profile {name} expected to exist, but is not included in the search ' + 'results' ) compute_resource_list = session.computeprofile.list_resources(name) assert f'{compute_resource.name} (Libvirt)' in [ @@ -45,11 +46,11 @@ def test_positive_end_to_end(session, module_location, module_org): ] session.computeprofile.rename(name, {'name': new_name}) assert entities.ComputeProfile().search(query={'search': f'name={new_name}'}), ( - 'Compute profile {} expected to exist, but is not included in the search ' - 'results'.format(new_name) + f'Compute profile {new_name} expected to exist, but is not included in the search ' + 'results' ) session.computeprofile.delete(new_name) assert not entities.ComputeProfile().search(query={'search': f'name={new_name}'}), ( - 'Compute profile {} expected to be deleted, but is included in the search ' - 'results'.format(new_name) + f'Compute profile {new_name} expected to be deleted, but is included in the search ' + 'results' ) diff --git a/tests/foreman/ui/test_computeresource.py b/tests/foreman/ui/test_computeresource.py index 7bd9f2552ce..b9823f339a9 100644 --- a/tests/foreman/ui/test_computeresource.py +++ b/tests/foreman/ui/test_computeresource.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from nailgun import entities import pytest from wait_for import wait_for @@ -283,7 +284,6 @@ def test_positive_VM_import(session, module_org, module_location, rhev_data): name = gen_string('alpha') with session: - session.computeresource.create( { 'name': name, diff --git a/tests/foreman/ui/test_computeresource_azurerm.py b/tests/foreman/ui/test_computeresource_azurerm.py index 36228513ffa..5d09ad88a69 100644 --- a/tests/foreman/ui/test_computeresource_azurerm.py +++ b/tests/foreman/ui/test_computeresource_azurerm.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_computeresource_ec2.py b/tests/foreman/ui/test_computeresource_ec2.py index 8f575bd4a80..ee554fb925f 100644 --- a/tests/foreman/ui/test_computeresource_ec2.py +++ b/tests/foreman/ui/test_computeresource_ec2.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string from nailgun import entities import pytest diff --git a/tests/foreman/ui/test_computeresource_gce.py b/tests/foreman/ui/test_computeresource_gce.py index a25edb1da44..4c48e902809 100644 --- a/tests/foreman/ui/test_computeresource_gce.py +++ b/tests/foreman/ui/test_computeresource_gce.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import json import random diff --git a/tests/foreman/ui/test_computeresource_libvirt.py b/tests/foreman/ui/test_computeresource_libvirt.py index 42477b8d46a..8328f1a4cf1 100644 --- a/tests/foreman/ui/test_computeresource_libvirt.py +++ b/tests/foreman/ui/test_computeresource_libvirt.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from random import choice from fauxfactory import gen_string diff --git a/tests/foreman/ui/test_computeresource_vmware.py b/tests/foreman/ui/test_computeresource_vmware.py index a9a17726267..6468f9f0937 100644 --- a/tests/foreman/ui/test_computeresource_vmware.py +++ b/tests/foreman/ui/test_computeresource_vmware.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from math import floor, log10 from random import choice diff --git a/tests/foreman/ui/test_config_group.py b/tests/foreman/ui/test_config_group.py index b38384d2977..34e6b32b9c9 100644 --- a/tests/foreman/ui/test_config_group.py +++ b/tests/foreman/ui/test_config_group.py @@ -11,6 +11,7 @@ :CaseImportance: Low """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_containerimagetag.py b/tests/foreman/ui/test_containerimagetag.py index 94f2ee1b607..75a5f5584b3 100644 --- a/tests/foreman/ui/test_containerimagetag.py +++ b/tests/foreman/ui/test_containerimagetag.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from nailgun import entities import pytest diff --git a/tests/foreman/ui/test_contentcredentials.py b/tests/foreman/ui/test_contentcredentials.py index 4fa3f519986..42be72d12ec 100644 --- a/tests/foreman/ui/test_contentcredentials.py +++ b/tests/foreman/ui/test_contentcredentials.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/ui/test_contenthost.py b/tests/foreman/ui/test_contenthost.py index 0aa59e545c0..a3cffed8ee4 100644 --- a/tests/foreman/ui/test_contenthost.py +++ b/tests/foreman/ui/test_contenthost.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime, timedelta import re from urllib.parse import urlparse @@ -1716,7 +1717,7 @@ def test_pagination_multiple_hosts_multiple_pages(session, module_host_template, f'os = {module_host_template.operatingsystem.name}' ) # Assert dump of fake hosts found includes the higest numbered host created for this test - match = re.search(fr'test-{host_num:0>2}', str(all_fake_hosts_found)) + match = re.search(rf'test-{host_num:0>2}', str(all_fake_hosts_found)) assert match, 'Highest numbered host not found.' # Get all the pagination values pagination_values = session.contenthost.read_all('Pagination')['Pagination'] @@ -1754,8 +1755,8 @@ def test_search_for_virt_who_hypervisors(session, default_location, module_targe hypervisor_display_name = f'virt-who-{hypervisor_name}-{org.id}' # Search with hypervisor=True gives the correct result. assert ( - session.contenthost.search('hypervisor = true')[0]['Name'] - ) == hypervisor_display_name + (session.contenthost.search('hypervisor = true')[0]['Name']) == hypervisor_display_name + ) # Search with hypervisor=false gives the correct result. content_hosts = [host['Name'] for host in session.contenthost.search('hypervisor = false')] assert hypervisor_display_name not in content_hosts diff --git a/tests/foreman/ui/test_contentview.py b/tests/foreman/ui/test_contentview.py index 0a7756746c2..8edbe49bb5a 100644 --- a/tests/foreman/ui/test_contentview.py +++ b/tests/foreman/ui/test_contentview.py @@ -14,6 +14,7 @@ :CaseImportance: High """ + import datetime from random import randint diff --git a/tests/foreman/ui/test_dashboard.py b/tests/foreman/ui/test_dashboard.py index 100bf3a4f7e..95af5c46b54 100644 --- a/tests/foreman/ui/test_dashboard.py +++ b/tests/foreman/ui/test_dashboard.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from nailgun.entity_mixins import TaskFailedError import pytest @@ -52,14 +53,14 @@ def test_positive_host_configuration_status(session, target_sat): 'Hosts with no reports', ] search_strings_list = [ - 'last_report > \"30 minutes ago\" and (status.applied > 0 or' + 'last_report > "30 minutes ago" and (status.applied > 0 or' ' status.restarted > 0) and (status.failed = 0)', - 'last_report > \"30 minutes ago\" and (status.failed > 0 or' + 'last_report > "30 minutes ago" and (status.failed > 0 or' ' status.failed_restarts > 0) and status.enabled = true', - 'last_report > \"30 minutes ago\" and status.enabled = true and' + 'last_report > "30 minutes ago" and status.enabled = true and' ' status.applied = 0 and status.failed = 0 and status.pending = 0', - 'last_report > \"30 minutes ago\" and status.pending > 0 and status.enabled = true', - 'last_report < \"30 minutes ago\" and status.enabled = true', + 'last_report > "30 minutes ago" and status.pending > 0 and status.enabled = true', + 'last_report < "30 minutes ago" and status.enabled = true', 'status.enabled = false', 'not has last_report and status.enabled = true', ] diff --git a/tests/foreman/ui/test_discoveredhost.py b/tests/foreman/ui/test_discoveredhost.py index 64476188f89..82fbdf5ca9d 100644 --- a/tests/foreman/ui/test_discoveredhost.py +++ b/tests/foreman/ui/test_discoveredhost.py @@ -9,6 +9,7 @@ :Team: Rocket """ + from fauxfactory import gen_string import pytest from wait_for import wait_for diff --git a/tests/foreman/ui/test_discoveryrule.py b/tests/foreman/ui/test_discoveryrule.py index 83ab23cbcc2..85958d57e53 100644 --- a/tests/foreman/ui/test_discoveryrule.py +++ b/tests/foreman/ui/test_discoveryrule.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_integer, gen_ipaddr, gen_string import pytest diff --git a/tests/foreman/ui/test_domain.py b/tests/foreman/ui/test_domain.py index 4f7594e6e74..6c86d3613b0 100644 --- a/tests/foreman/ui/test_domain.py +++ b/tests/foreman/ui/test_domain.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string from nailgun import entities import pytest diff --git a/tests/foreman/ui/test_hardwaremodel.py b/tests/foreman/ui/test_hardwaremodel.py index 38ab302dfcf..ddf3833c902 100644 --- a/tests/foreman/ui/test_hardwaremodel.py +++ b/tests/foreman/ui/test_hardwaremodel.py @@ -9,6 +9,7 @@ :Team: Endeavour """ + from fauxfactory import gen_string from nailgun import entities import pytest diff --git a/tests/foreman/ui/test_host.py b/tests/foreman/ui/test_host.py index c42bf98d92e..ed634bc1400 100644 --- a/tests/foreman/ui/test_host.py +++ b/tests/foreman/ui/test_host.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import copy import csv import os diff --git a/tests/foreman/ui/test_hostcollection.py b/tests/foreman/ui/test_hostcollection.py index 73450ac90b4..67d4b434ee7 100644 --- a/tests/foreman/ui/test_hostcollection.py +++ b/tests/foreman/ui/test_hostcollection.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import time from broker import Broker diff --git a/tests/foreman/ui/test_hostgroup.py b/tests/foreman/ui/test_hostgroup.py index 964dedc172f..789519d332f 100644 --- a/tests/foreman/ui/test_hostgroup.py +++ b/tests/foreman/ui/test_hostgroup.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string from nailgun import entities import pytest diff --git a/tests/foreman/ui/test_http_proxy.py b/tests/foreman/ui/test_http_proxy.py index 9e3f1e5b10b..2f1fe0e388e 100644 --- a/tests/foreman/ui/test_http_proxy.py +++ b/tests/foreman/ui/test_http_proxy.py @@ -11,6 +11,7 @@ :CaseAutomation: Automated """ + from fauxfactory import gen_integer, gen_string, gen_url import pytest diff --git a/tests/foreman/ui/test_jobinvocation.py b/tests/foreman/ui/test_jobinvocation.py index 1e684ea9be1..6c197eaeba9 100644 --- a/tests/foreman/ui/test_jobinvocation.py +++ b/tests/foreman/ui/test_jobinvocation.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from inflection import camelize import pytest diff --git a/tests/foreman/ui/test_jobtemplate.py b/tests/foreman/ui/test_jobtemplate.py index 10ff62efb5a..08abba1ceb2 100644 --- a/tests/foreman/ui/test_jobtemplate.py +++ b/tests/foreman/ui/test_jobtemplate.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_ldap_authentication.py b/tests/foreman/ui/test_ldap_authentication.py index a6e3af6d612..15f5d0d218a 100644 --- a/tests/foreman/ui/test_ldap_authentication.py +++ b/tests/foreman/ui/test_ldap_authentication.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import os from fauxfactory import gen_url @@ -404,9 +405,12 @@ def test_positive_delete_external_roles( session.usergroup.update( ldap_usergroup_name, {'roles.resources.unassigned': [foreman_role.name]} ) - with target_sat.ui_session( - test_name, ldap_data['ldap_user_name'], ldap_data['ldap_user_passwd'] - ) as ldapsession, pytest.raises(NavigationTriesExceeded): + with ( + target_sat.ui_session( + test_name, ldap_data['ldap_user_name'], ldap_data['ldap_user_passwd'] + ) as ldapsession, + pytest.raises(NavigationTriesExceeded), + ): ldapsession.location.create({'name': gen_string('alpha')}) @@ -758,9 +762,12 @@ def test_positive_login_user_basic_roles( role = target_sat.api.Role().create() permissions = {'Architecture': PERMISSIONS['Architecture']} target_sat.api_factory.create_role_permissions(role, permissions) - with target_sat.ui_session( - test_name, ldap_data['ldap_user_name'], ldap_data['ldap_user_passwd'] - ) as ldapsession, pytest.raises(NavigationTriesExceeded): + with ( + target_sat.ui_session( + test_name, ldap_data['ldap_user_name'], ldap_data['ldap_user_passwd'] + ) as ldapsession, + pytest.raises(NavigationTriesExceeded), + ): ldapsession.usergroup.search('') with session: session.user.update(ldap_data['ldap_user_name'], {'roles.resources.assigned': [role.name]}) @@ -792,9 +799,12 @@ def test_positive_login_user_password_otp( otp_pass = ( f"{default_ipa_host.ldap_user_passwd}{generate_otp(default_ipa_host.time_based_secret)}" ) - with target_sat.ui_session( - test_name, default_ipa_host.ipa_otp_username, otp_pass - ) as ldapsession, pytest.raises(NavigationTriesExceeded): + with ( + target_sat.ui_session( + test_name, default_ipa_host.ipa_otp_username, otp_pass + ) as ldapsession, + pytest.raises(NavigationTriesExceeded), + ): ldapsession.user.search('') users = target_sat.api.User().search( query={'search': f'login="{default_ipa_host.ipa_otp_username}"'} @@ -1210,11 +1220,14 @@ def test_userlist_with_external_admin( assert idm_user in ldapsession.task.read_all()['current_user'] # verify the users count with local admin and remote/external admin - with target_sat.ui_session( - user=idm_admin, password=settings.server.ssh_password - ) as remote_admin_session, target_sat.ui_session( - user=settings.server.admin_username, password=settings.server.admin_password - ) as local_admin_session: + with ( + target_sat.ui_session( + user=idm_admin, password=settings.server.ssh_password + ) as remote_admin_session, + target_sat.ui_session( + user=settings.server.admin_username, password=settings.server.admin_password + ) as local_admin_session, + ): assert local_admin_session.user.search(idm_user)[0]['Username'] == idm_user assert remote_admin_session.user.search(idm_user)[0]['Username'] == idm_user diff --git a/tests/foreman/ui/test_lifecycleenvironment.py b/tests/foreman/ui/test_lifecycleenvironment.py index 9c389fdd19d..f3c966bd10d 100644 --- a/tests/foreman/ui/test_lifecycleenvironment.py +++ b/tests/foreman/ui/test_lifecycleenvironment.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from navmazing import NavigationTriesExceeded import pytest diff --git a/tests/foreman/ui/test_location.py b/tests/foreman/ui/test_location.py index e9428868c0c..590aa5bcc34 100644 --- a/tests/foreman/ui/test_location.py +++ b/tests/foreman/ui/test_location.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_ipaddr, gen_string from nailgun import entities import pytest diff --git a/tests/foreman/ui/test_media.py b/tests/foreman/ui/test_media.py index 446ecd64542..c07916a99d2 100644 --- a/tests/foreman/ui/test_media.py +++ b/tests/foreman/ui/test_media.py @@ -11,6 +11,7 @@ :CaseImportance: Low """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_modulestreams.py b/tests/foreman/ui/test_modulestreams.py index f8a67ed15c6..126b0c3f442 100644 --- a/tests/foreman/ui/test_modulestreams.py +++ b/tests/foreman/ui/test_modulestreams.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string from nailgun import entities import pytest diff --git a/tests/foreman/ui/test_operatingsystem.py b/tests/foreman/ui/test_operatingsystem.py index 1324b556230..71a030772c6 100644 --- a/tests/foreman/ui/test_operatingsystem.py +++ b/tests/foreman/ui/test_operatingsystem.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.constants import HASH_TYPE diff --git a/tests/foreman/ui/test_organization.py b/tests/foreman/ui/test_organization.py index 4365697efca..8d72d8184a7 100644 --- a/tests/foreman/ui/test_organization.py +++ b/tests/foreman/ui/test_organization.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string from nailgun import entities import pytest diff --git a/tests/foreman/ui/test_oscapcontent.py b/tests/foreman/ui/test_oscapcontent.py index 5669fb9e854..a87abb91e75 100644 --- a/tests/foreman/ui/test_oscapcontent.py +++ b/tests/foreman/ui/test_oscapcontent.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import os import pytest diff --git a/tests/foreman/ui/test_oscappolicy.py b/tests/foreman/ui/test_oscappolicy.py index 712e6f37481..83c7e8be058 100644 --- a/tests/foreman/ui/test_oscappolicy.py +++ b/tests/foreman/ui/test_oscappolicy.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from nailgun import entities import pytest diff --git a/tests/foreman/ui/test_oscaptailoringfile.py b/tests/foreman/ui/test_oscaptailoringfile.py index 0f6bdcdfc63..5b1dd6c8606 100644 --- a/tests/foreman/ui/test_oscaptailoringfile.py +++ b/tests/foreman/ui/test_oscaptailoringfile.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from nailgun import entities import pytest diff --git a/tests/foreman/ui/test_package.py b/tests/foreman/ui/test_package.py index 643608811d1..a66ff706dbb 100644 --- a/tests/foreman/ui/test_package.py +++ b/tests/foreman/ui/test_package.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string from nailgun import entities import pytest diff --git a/tests/foreman/ui/test_partitiontable.py b/tests/foreman/ui/test_partitiontable.py index 8877c3d6a45..cfbbb525ad7 100644 --- a/tests/foreman/ui/test_partitiontable.py +++ b/tests/foreman/ui/test_partitiontable.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_product.py b/tests/foreman/ui/test_product.py index 71a468ccb8e..1c6e986a527 100644 --- a/tests/foreman/ui/test_product.py +++ b/tests/foreman/ui/test_product.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import timedelta from fauxfactory import gen_choice diff --git a/tests/foreman/ui/test_provisioningtemplate.py b/tests/foreman/ui/test_provisioningtemplate.py index da2b8446dce..7ad306e2465 100644 --- a/tests/foreman/ui/test_provisioningtemplate.py +++ b/tests/foreman/ui/test_provisioningtemplate.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.constants import DataFile diff --git a/tests/foreman/ui/test_puppetclass.py b/tests/foreman/ui/test_puppetclass.py index b44ad73e7a7..42ae2b359ab 100644 --- a/tests/foreman/ui/test_puppetclass.py +++ b/tests/foreman/ui/test_puppetclass.py @@ -11,6 +11,7 @@ :CaseImportance: Low """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_puppetenvironment.py b/tests/foreman/ui/test_puppetenvironment.py index 57502a51191..6add5508549 100644 --- a/tests/foreman/ui/test_puppetenvironment.py +++ b/tests/foreman/ui/test_puppetenvironment.py @@ -11,6 +11,7 @@ :CaseImportance: Low """ + import pytest from robottelo.constants import DEFAULT_CV, ENVIRONMENT diff --git a/tests/foreman/ui/test_registration.py b/tests/foreman/ui/test_registration.py index d8b979ba0c2..dabdcab47e9 100644 --- a/tests/foreman/ui/test_registration.py +++ b/tests/foreman/ui/test_registration.py @@ -10,6 +10,7 @@ :Team: Rocket """ + from datetime import datetime import re @@ -525,7 +526,6 @@ def test_positive_host_registration_with_non_admin_user( target_sat.cli.User.add_role({'id': user.id, 'role-id': role['id']}) with Session(test_name, user=user.login, password=user_password) as session: - cmd = session.host_new.get_register_command( { 'general.insecure': True, diff --git a/tests/foreman/ui/test_remoteexecution.py b/tests/foreman/ui/test_remoteexecution.py index f939afda4b8..76cd249d1fb 100644 --- a/tests/foreman/ui/test_remoteexecution.py +++ b/tests/foreman/ui/test_remoteexecution.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import datetime import time diff --git a/tests/foreman/ui/test_reporttemplates.py b/tests/foreman/ui/test_reporttemplates.py index f8fbfff52d9..262bddf9d45 100644 --- a/tests/foreman/ui/test_reporttemplates.py +++ b/tests/foreman/ui/test_reporttemplates.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import csv import json import os diff --git a/tests/foreman/ui/test_repositories.py b/tests/foreman/ui/test_repositories.py index 4afe48d82a9..e82a110608e 100644 --- a/tests/foreman/ui/test_repositories.py +++ b/tests/foreman/ui/test_repositories.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest diff --git a/tests/foreman/ui/test_repository.py b/tests/foreman/ui/test_repository.py index 010bf9d5dc6..065d47d0a07 100644 --- a/tests/foreman/ui/test_repository.py +++ b/tests/foreman/ui/test_repository.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime, timedelta from random import randint, shuffle diff --git a/tests/foreman/ui/test_rhc.py b/tests/foreman/ui/test_rhc.py index df90a5768ca..b9f02dcee8f 100644 --- a/tests/foreman/ui/test_rhc.py +++ b/tests/foreman/ui/test_rhc.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime, timedelta from fauxfactory import gen_string diff --git a/tests/foreman/ui/test_rhcloud_insights.py b/tests/foreman/ui/test_rhcloud_insights.py index 3646658c2b0..286727095d1 100644 --- a/tests/foreman/ui/test_rhcloud_insights.py +++ b/tests/foreman/ui/test_rhcloud_insights.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime import pytest diff --git a/tests/foreman/ui/test_rhcloud_inventory.py b/tests/foreman/ui/test_rhcloud_inventory.py index 9c98ade0205..f576f88b3e0 100644 --- a/tests/foreman/ui/test_rhcloud_inventory.py +++ b/tests/foreman/ui/test_rhcloud_inventory.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime, timedelta import pytest diff --git a/tests/foreman/ui/test_role.py b/tests/foreman/ui/test_role.py index 810fa73f8cd..7388bf0d4b6 100644 --- a/tests/foreman/ui/test_role.py +++ b/tests/foreman/ui/test_role.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from navmazing import NavigationTriesExceeded diff --git a/tests/foreman/ui/test_settings.py b/tests/foreman/ui/test_settings.py index 72bcf9223f0..e734fddd33c 100644 --- a/tests/foreman/ui/test_settings.py +++ b/tests/foreman/ui/test_settings.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import math from fauxfactory import gen_url diff --git a/tests/foreman/ui/test_smartclassparameter.py b/tests/foreman/ui/test_smartclassparameter.py index adc5169f2ae..7cfe14cd036 100644 --- a/tests/foreman/ui/test_smartclassparameter.py +++ b/tests/foreman/ui/test_smartclassparameter.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from random import choice, uniform import pytest diff --git a/tests/foreman/ui/test_subnet.py b/tests/foreman/ui/test_subnet.py index 45886c3ec86..c29bfcb850a 100644 --- a/tests/foreman/ui/test_subnet.py +++ b/tests/foreman/ui/test_subnet.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_ipaddr import pytest diff --git a/tests/foreman/ui/test_subscription.py b/tests/foreman/ui/test_subscription.py index 9ef5ff377d3..23417bc664d 100644 --- a/tests/foreman/ui/test_subscription.py +++ b/tests/foreman/ui/test_subscription.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from tempfile import mkstemp import time diff --git a/tests/foreman/ui/test_sync.py b/tests/foreman/ui/test_sync.py index 308ef7b485a..064b20ca4bb 100644 --- a/tests/foreman/ui/test_sync.py +++ b/tests/foreman/ui/test_sync.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string from nailgun import entities import pytest diff --git a/tests/foreman/ui/test_syncplan.py b/tests/foreman/ui/test_syncplan.py index 29201f0c6e5..9e84d28bd4b 100644 --- a/tests/foreman/ui/test_syncplan.py +++ b/tests/foreman/ui/test_syncplan.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime, timedelta import time diff --git a/tests/foreman/ui/test_templatesync.py b/tests/foreman/ui/test_templatesync.py index d2679e1bf62..bde5d190fbb 100644 --- a/tests/foreman/ui/test_templatesync.py +++ b/tests/foreman/ui/test_templatesync.py @@ -9,6 +9,7 @@ :Team: Endeavour """ + from fauxfactory import gen_string from nailgun import entities import pytest diff --git a/tests/foreman/ui/test_user.py b/tests/foreman/ui/test_user.py index 48f04cd5a06..f1a492860e6 100644 --- a/tests/foreman/ui/test_user.py +++ b/tests/foreman/ui/test_user.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from fauxfactory import gen_email, gen_string diff --git a/tests/foreman/ui/test_usergroup.py b/tests/foreman/ui/test_usergroup.py index 37b2afaa9d6..e6687785d05 100644 --- a/tests/foreman/ui/test_usergroup.py +++ b/tests/foreman/ui/test_usergroup.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string, gen_utf8 from nailgun import entities import pytest diff --git a/tests/foreman/ui/test_webhook.py b/tests/foreman/ui/test_webhook.py index c0e3b470c20..90668a8f9d9 100644 --- a/tests/foreman/ui/test_webhook.py +++ b/tests/foreman/ui/test_webhook.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string, gen_url import pytest diff --git a/tests/foreman/virtwho/api/test_esx.py b/tests/foreman/virtwho/api/test_esx.py index bb6046188a0..4b208bae4c8 100644 --- a/tests/foreman/virtwho/api/test_esx.py +++ b/tests/foreman/virtwho/api/test_esx.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings @@ -359,9 +360,7 @@ def test_positive_remove_env_option( # Check the option "env=" should be removed from etc/virt-who.d/virt-who.conf option = "env" config_file = get_configure_file(virtwho_config_api.id) - env_error = ( - f"option {{\'{option}\'}} is not exist or not be enabled in {{\'{config_file}\'}}" - ) + env_error = f"option {{'{option}'}} is not exist or not be enabled in {{'{config_file}'}}" with pytest.raises(Exception) as exc_info: # noqa: PT011 - TODO determine better exception get_configure_option({option}, {config_file}) assert str(exc_info.value) == env_error diff --git a/tests/foreman/virtwho/api/test_esx_sca.py b/tests/foreman/virtwho/api/test_esx_sca.py index 2d43f59637a..10c9500eed9 100644 --- a/tests/foreman/virtwho/api/test_esx_sca.py +++ b/tests/foreman/virtwho/api/test_esx_sca.py @@ -9,6 +9,7 @@ :Team: Phoenix """ + import pytest from robottelo.config import settings @@ -407,9 +408,7 @@ def test_positive_remove_env_option( # Check the option "env=" should be removed from etc/virt-who.d/virt-who.conf option = "env" config_file = get_configure_file(virtwho_config_api.id) - env_error = ( - f"option {{\'{option}\'}} is not exist or not be enabled in {{\'{config_file}\'}}" - ) + env_error = f"option {{'{option}'}} is not exist or not be enabled in {{'{config_file}'}}" with pytest.raises(Exception) as exc_info: # noqa: PT011 - TODO determine better exception get_configure_option({option}, {config_file}) assert str(exc_info.value) == env_error diff --git a/tests/foreman/virtwho/api/test_hyperv.py b/tests/foreman/virtwho/api/test_hyperv.py index 6d93f1ddb9a..d66c13ed62f 100644 --- a/tests/foreman/virtwho/api/test_hyperv.py +++ b/tests/foreman/virtwho/api/test_hyperv.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/virtwho/api/test_hyperv_sca.py b/tests/foreman/virtwho/api/test_hyperv_sca.py index 715ac92cd12..e74748cde66 100644 --- a/tests/foreman/virtwho/api/test_hyperv_sca.py +++ b/tests/foreman/virtwho/api/test_hyperv_sca.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.utils.virtwho import ( diff --git a/tests/foreman/virtwho/api/test_kubevirt.py b/tests/foreman/virtwho/api/test_kubevirt.py index ef1e7ac578d..ece48a67245 100644 --- a/tests/foreman/virtwho/api/test_kubevirt.py +++ b/tests/foreman/virtwho/api/test_kubevirt.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/virtwho/api/test_kubevirt_sca.py b/tests/foreman/virtwho/api/test_kubevirt_sca.py index 51628052cd9..56f34e17ecb 100644 --- a/tests/foreman/virtwho/api/test_kubevirt_sca.py +++ b/tests/foreman/virtwho/api/test_kubevirt_sca.py @@ -9,6 +9,7 @@ :team: Phoenix-subscriptions """ + import pytest from robottelo.utils.virtwho import ( diff --git a/tests/foreman/virtwho/api/test_libvirt.py b/tests/foreman/virtwho/api/test_libvirt.py index b551e0e81dc..677d5124a24 100644 --- a/tests/foreman/virtwho/api/test_libvirt.py +++ b/tests/foreman/virtwho/api/test_libvirt.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/virtwho/api/test_libvirt_sca.py b/tests/foreman/virtwho/api/test_libvirt_sca.py index f88edd8d478..34d6b78f84c 100644 --- a/tests/foreman/virtwho/api/test_libvirt_sca.py +++ b/tests/foreman/virtwho/api/test_libvirt_sca.py @@ -9,6 +9,7 @@ :team: Phoenix-subscriptions """ + import pytest from robottelo.utils.virtwho import ( diff --git a/tests/foreman/virtwho/api/test_nutanix.py b/tests/foreman/virtwho/api/test_nutanix.py index e40433b1c57..6e29e638478 100644 --- a/tests/foreman/virtwho/api/test_nutanix.py +++ b/tests/foreman/virtwho/api/test_nutanix.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/virtwho/api/test_nutanix_sca.py b/tests/foreman/virtwho/api/test_nutanix_sca.py index 14b6d2a04fd..b6f7bbc9356 100644 --- a/tests/foreman/virtwho/api/test_nutanix_sca.py +++ b/tests/foreman/virtwho/api/test_nutanix_sca.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.utils.virtwho import ( diff --git a/tests/foreman/virtwho/cli/test_esx.py b/tests/foreman/virtwho/cli/test_esx.py index 8ff62af3688..bbdc25a4b7e 100644 --- a/tests/foreman/virtwho/cli/test_esx.py +++ b/tests/foreman/virtwho/cli/test_esx.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import re from fauxfactory import gen_string @@ -411,9 +412,7 @@ def test_positive_remove_env_option( # Check the option "env=" should be removed from etc/virt-who.d/virt-who.conf option = "env" config_file = get_configure_file(virtwho_config_cli['id']) - env_error = ( - f"option {{\'{option}\'}} is not exist or not be enabled in {{\'{config_file}\'}}" - ) + env_error = f"option {{'{option}'}} is not exist or not be enabled in {{'{config_file}'}}" with pytest.raises(Exception) as exc_info: # noqa: PT011 - TODO determine better exception get_configure_option({option}, {config_file}) assert str(exc_info.value) == env_error diff --git a/tests/foreman/virtwho/cli/test_esx_sca.py b/tests/foreman/virtwho/cli/test_esx_sca.py index 25641bcd2ba..41475e4f3f4 100644 --- a/tests/foreman/virtwho/cli/test_esx_sca.py +++ b/tests/foreman/virtwho/cli/test_esx_sca.py @@ -9,6 +9,7 @@ :Team: Phoenix """ + import re from fauxfactory import gen_string @@ -493,9 +494,7 @@ def test_positive_remove_env_option( # Check the option "env=" should be removed from etc/virt-who.d/virt-who.conf option = "env" config_file = get_configure_file(virtwho_config_cli['id']) - env_error = ( - f"option {{\'{option}\'}} is not exist or not be enabled in {{\'{config_file}\'}}" - ) + env_error = f"option {{'{option}'}} is not exist or not be enabled in {{'{config_file}'}}" with pytest.raises(Exception) as exc_info: # noqa: PT011 - TODO determine better exception get_configure_option({option}, {config_file}) assert str(exc_info.value) == env_error diff --git a/tests/foreman/virtwho/cli/test_hyperv.py b/tests/foreman/virtwho/cli/test_hyperv.py index 657ee3e04f6..98f84d277e1 100644 --- a/tests/foreman/virtwho/cli/test_hyperv.py +++ b/tests/foreman/virtwho/cli/test_hyperv.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/virtwho/cli/test_hyperv_sca.py b/tests/foreman/virtwho/cli/test_hyperv_sca.py index 7c59213485d..e72da8f78e0 100644 --- a/tests/foreman/virtwho/cli/test_hyperv_sca.py +++ b/tests/foreman/virtwho/cli/test_hyperv_sca.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.utils.virtwho import ( diff --git a/tests/foreman/virtwho/cli/test_kubevirt.py b/tests/foreman/virtwho/cli/test_kubevirt.py index f29a22e4a16..88e9bcdcc2e 100644 --- a/tests/foreman/virtwho/cli/test_kubevirt.py +++ b/tests/foreman/virtwho/cli/test_kubevirt.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/virtwho/cli/test_kubevirt_sca.py b/tests/foreman/virtwho/cli/test_kubevirt_sca.py index d682b5f9159..1c96fbc88a6 100644 --- a/tests/foreman/virtwho/cli/test_kubevirt_sca.py +++ b/tests/foreman/virtwho/cli/test_kubevirt_sca.py @@ -9,6 +9,7 @@ :team: Phoenix-subscriptions """ + import pytest from robottelo.utils.virtwho import ( diff --git a/tests/foreman/virtwho/cli/test_libvirt.py b/tests/foreman/virtwho/cli/test_libvirt.py index 70ac4056fa3..ea8f09c9cd0 100644 --- a/tests/foreman/virtwho/cli/test_libvirt.py +++ b/tests/foreman/virtwho/cli/test_libvirt.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/virtwho/cli/test_libvirt_sca.py b/tests/foreman/virtwho/cli/test_libvirt_sca.py index 2bfeda30801..85ee3e8d7f0 100644 --- a/tests/foreman/virtwho/cli/test_libvirt_sca.py +++ b/tests/foreman/virtwho/cli/test_libvirt_sca.py @@ -9,6 +9,7 @@ :team: Phoenix-subscriptions """ + import pytest from robottelo.utils.virtwho import ( diff --git a/tests/foreman/virtwho/cli/test_nutanix.py b/tests/foreman/virtwho/cli/test_nutanix.py index b5478912ab7..7233e8454d2 100644 --- a/tests/foreman/virtwho/cli/test_nutanix.py +++ b/tests/foreman/virtwho/cli/test_nutanix.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/virtwho/cli/test_nutanix_sca.py b/tests/foreman/virtwho/cli/test_nutanix_sca.py index 360aac0f676..a3ed65953a3 100644 --- a/tests/foreman/virtwho/cli/test_nutanix_sca.py +++ b/tests/foreman/virtwho/cli/test_nutanix_sca.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.utils.virtwho import ( diff --git a/tests/foreman/virtwho/ui/test_esx.py b/tests/foreman/virtwho/ui/test_esx.py index efd46e6deba..dc615e7b4a5 100644 --- a/tests/foreman/virtwho/ui/test_esx.py +++ b/tests/foreman/virtwho/ui/test_esx.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime from fauxfactory import gen_string @@ -731,9 +732,7 @@ def test_positive_remove_env_option( option = "env" config_id = get_configure_id(name) config_file = get_configure_file(config_id) - env_error = ( - f"option {{\'{option}\'}} is not exist or not be enabled in {{\'{config_file}\'}}" - ) + env_error = f"option {{'{option}'}} is not exist or not be enabled in {{'{config_file}'}}" with pytest.raises(Exception) as exc_info: # noqa: PT011 - TODO determine better exception get_configure_option({option}, {config_file}) assert str(exc_info.value) == env_error diff --git a/tests/foreman/virtwho/ui/test_esx_sca.py b/tests/foreman/virtwho/ui/test_esx_sca.py index 3656ba09038..118e7a0cfb0 100644 --- a/tests/foreman/virtwho/ui/test_esx_sca.py +++ b/tests/foreman/virtwho/ui/test_esx_sca.py @@ -9,6 +9,7 @@ :team: Phoenix-subscriptions """ + from datetime import datetime from airgun.session import Session @@ -312,9 +313,7 @@ def test_positive_remove_env_option( option = "env" config_id = get_configure_id(name) config_file = get_configure_file(config_id) - env_error = ( - f"option {{\'{option}\'}} is not exist or not be enabled in {{\'{config_file}\'}}" - ) + env_error = f"option {{'{option}'}} is not exist or not be enabled in {{'{config_file}'}}" with pytest.raises(Exception) as exc_info: # noqa: PT011 - TODO determine better exception get_configure_option({option}, {config_file}) assert str(exc_info.value) == env_error diff --git a/tests/foreman/virtwho/ui/test_hyperv.py b/tests/foreman/virtwho/ui/test_hyperv.py index 8348540326f..2db519760fe 100644 --- a/tests/foreman/virtwho/ui/test_hyperv.py +++ b/tests/foreman/virtwho/ui/test_hyperv.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/virtwho/ui/test_hyperv_sca.py b/tests/foreman/virtwho/ui/test_hyperv_sca.py index ba172ba596f..9f304a8ab5b 100644 --- a/tests/foreman/virtwho/ui/test_hyperv_sca.py +++ b/tests/foreman/virtwho/ui/test_hyperv_sca.py @@ -9,6 +9,7 @@ :Team: Phoenix """ + import pytest from robottelo.utils.virtwho import ( diff --git a/tests/foreman/virtwho/ui/test_kubevirt.py b/tests/foreman/virtwho/ui/test_kubevirt.py index e12c4774fc8..0f8a01f3177 100644 --- a/tests/foreman/virtwho/ui/test_kubevirt.py +++ b/tests/foreman/virtwho/ui/test_kubevirt.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/virtwho/ui/test_kubevirt_sca.py b/tests/foreman/virtwho/ui/test_kubevirt_sca.py index c11ba3098a4..137686c743d 100644 --- a/tests/foreman/virtwho/ui/test_kubevirt_sca.py +++ b/tests/foreman/virtwho/ui/test_kubevirt_sca.py @@ -9,6 +9,7 @@ :Team: Phoenix """ + import pytest from robottelo.utils.virtwho import ( diff --git a/tests/foreman/virtwho/ui/test_libvirt.py b/tests/foreman/virtwho/ui/test_libvirt.py index a66bf1737bb..1d1ffaa0dcc 100644 --- a/tests/foreman/virtwho/ui/test_libvirt.py +++ b/tests/foreman/virtwho/ui/test_libvirt.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/virtwho/ui/test_libvirt_sca.py b/tests/foreman/virtwho/ui/test_libvirt_sca.py index 38fe5d2cd56..1df5171779b 100644 --- a/tests/foreman/virtwho/ui/test_libvirt_sca.py +++ b/tests/foreman/virtwho/ui/test_libvirt_sca.py @@ -9,6 +9,7 @@ :Team: Phoenix """ + import pytest from robottelo.utils.virtwho import ( diff --git a/tests/foreman/virtwho/ui/test_nutanix.py b/tests/foreman/virtwho/ui/test_nutanix.py index 7ec05f191df..2b7295fd359 100644 --- a/tests/foreman/virtwho/ui/test_nutanix.py +++ b/tests/foreman/virtwho/ui/test_nutanix.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/virtwho/ui/test_nutanix_sca.py b/tests/foreman/virtwho/ui/test_nutanix_sca.py index bb2483195d1..b085fc55ec1 100644 --- a/tests/foreman/virtwho/ui/test_nutanix_sca.py +++ b/tests/foreman/virtwho/ui/test_nutanix_sca.py @@ -9,6 +9,7 @@ :Team: Phoenix-subscriptions """ + from fauxfactory import gen_string import pytest diff --git a/tests/robottelo/test_datafactory.py b/tests/robottelo/test_datafactory.py index b93d401ed89..9d8406640c4 100644 --- a/tests/robottelo/test_datafactory.py +++ b/tests/robottelo/test_datafactory.py @@ -1,4 +1,5 @@ """Tests for module ``robottelo.utils.datafactory``.""" + import itertools import random from unittest import mock diff --git a/tests/robottelo/test_decorators.py b/tests/robottelo/test_decorators.py index 6c5e60f568a..9a50461962a 100644 --- a/tests/robottelo/test_decorators.py +++ b/tests/robottelo/test_decorators.py @@ -1,4 +1,5 @@ """Unit tests for :mod:`robottelo.utils.decorators`.""" + from unittest import mock import pytest diff --git a/tests/robottelo/test_dependencies.py b/tests/robottelo/test_dependencies.py index 950cbeebec4..d12372a64a8 100644 --- a/tests/robottelo/test_dependencies.py +++ b/tests/robottelo/test_dependencies.py @@ -1,4 +1,5 @@ """Test important behavior in robottelo's direct dependencies""" + import contextlib diff --git a/tests/robottelo/test_func_locker.py b/tests/robottelo/test_func_locker.py index d0da97431e0..de2ef29aa33 100644 --- a/tests/robottelo/test_func_locker.py +++ b/tests/robottelo/test_func_locker.py @@ -96,8 +96,9 @@ def simple_recursive_locking_function(): """try to trigger the same lock from the same process, an exception should be expected """ - with func_locker.locking_function(simple_locked_function), func_locker.locking_function( - simple_locked_function + with ( + func_locker.locking_function(simple_locked_function), + func_locker.locking_function(simple_locked_function), ): pass return 'I should not be reached' @@ -125,9 +126,10 @@ def simple_function_to_lock(): def simple_with_locking_function(index=None): global counter_file time.sleep(0.05) - with func_locker.locking_function(simple_locked_function), open( - _get_function_lock_path('simple_locked_function') - ) as rf: + with ( + func_locker.locking_function(simple_locked_function), + open(_get_function_lock_path('simple_locked_function')) as rf, + ): content = rf.read() if index is not None: @@ -234,9 +236,10 @@ def test_locker_file_location_when_in_class(self): content = '' assert str(os.getpid()) != content - with func_locker.locking_function(SimpleClass.simple_function_to_lock), open( - file_path - ) as rf: + with ( + func_locker.locking_function(SimpleClass.simple_function_to_lock), + open(file_path) as rf, + ): content = rf.read() assert str(os.getpid()) == content @@ -249,9 +252,10 @@ def test_locker_file_location_when_in_class(self): content = '' assert str(os.getpid()) != content - with func_locker.locking_function(SimpleClass.simple_function_to_lock_cls), open( - file_path - ) as rf: + with ( + func_locker.locking_function(SimpleClass.simple_function_to_lock_cls), + open(file_path) as rf, + ): content = rf.read() assert str(os.getpid()) == content @@ -296,9 +300,10 @@ def test_locker_file_location_when_in_class(self): else: content = '' assert str(os.getpid()) != content - with func_locker.locking_function(SimpleClass.SubClass.simple_function_to_lock_cls), open( - file_path - ) as rf: + with ( + func_locker.locking_function(SimpleClass.SubClass.simple_function_to_lock_cls), + open(file_path) as rf, + ): content = rf.read() assert str(os.getpid()) == content @@ -410,7 +415,8 @@ def test_scoped_with_locking(self): assert os.path.exists(lock_file_path) def test_negative_with_locking_not_locked(self): - with pytest.raises( - func_locker.FunctionLockerError, match=r'.*Cannot ensure locking.*' - ), func_locker.locking_function(simple_function_not_locked): + with ( + pytest.raises(func_locker.FunctionLockerError, match=r'.*Cannot ensure locking.*'), + func_locker.locking_function(simple_function_not_locked), + ): pass diff --git a/tests/robottelo/test_hammer.py b/tests/robottelo/test_hammer.py index 0a887a4c0bc..fce548fa0d6 100644 --- a/tests/robottelo/test_hammer.py +++ b/tests/robottelo/test_hammer.py @@ -1,4 +1,5 @@ """Tests for Robottelo's hammer helpers""" + from robottelo.cli import hammer diff --git a/tests/robottelo/test_helpers.py b/tests/robottelo/test_helpers.py index 0b39bb54b9e..b73fb78af7d 100644 --- a/tests/robottelo/test_helpers.py +++ b/tests/robottelo/test_helpers.py @@ -1,4 +1,5 @@ """Tests for module ``robottelo.helpers``.""" + import pytest from robottelo.utils import slugify_component, validate_ssh_pub_key diff --git a/tests/robottelo/test_issue_handlers.py b/tests/robottelo/test_issue_handlers.py index d8fdce0c7b0..430cf18644b 100644 --- a/tests/robottelo/test_issue_handlers.py +++ b/tests/robottelo/test_issue_handlers.py @@ -365,7 +365,6 @@ def _remove_file(): os.remove(DEFAULT_BZ_CACHE_FILE) try: - subprocess.run( [sys.executable, '-m', 'pytest', '--collect-only', 'tests/robottelo'], check=True ) @@ -408,7 +407,11 @@ def test_add_workaround(): add_workaround(data, matches, 'test', foo='bar') add_workaround( - data, matches, 'test', validation=lambda *a, **k: False, zaz='traz' # Should not be added + data, + matches, + 'test', + validation=lambda *a, **k: False, + zaz='traz', # Should not be added ) for match in matches: diff --git a/tests/robottelo/test_ssh.py b/tests/robottelo/test_ssh.py index 6167a0292be..28012695d96 100644 --- a/tests/robottelo/test_ssh.py +++ b/tests/robottelo/test_ssh.py @@ -1,4 +1,5 @@ """Tests for module ``robottelo.utils.ssh``.""" + from unittest import mock from robottelo import ssh diff --git a/tests/upgrades/conftest.py b/tests/upgrades/conftest.py index 4c759f66b72..afa8c8eb21c 100644 --- a/tests/upgrades/conftest.py +++ b/tests/upgrades/conftest.py @@ -81,6 +81,7 @@ def test_capsule_post_upgrade_skipped(pre_upgrade_data): # in post_upgrade scenario, test results should be # 2 passed, 6 deselected """ + import datetime import functools import json diff --git a/tests/upgrades/test_activation_key.py b/tests/upgrades/test_activation_key.py index 11d37ccdab0..540c5b52b58 100644 --- a/tests/upgrades/test_activation_key.py +++ b/tests/upgrades/test_activation_key.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from requests.exceptions import HTTPError diff --git a/tests/upgrades/test_bookmarks.py b/tests/upgrades/test_bookmarks.py index ff53bcdb30b..f9f0986aec0 100644 --- a/tests/upgrades/test_bookmarks.py +++ b/tests/upgrades/test_bookmarks.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.constants import BOOKMARK_ENTITIES_SELECTION diff --git a/tests/upgrades/test_capsule.py b/tests/upgrades/test_capsule.py index c7cf63e9977..e106c9a860e 100644 --- a/tests/upgrades/test_capsule.py +++ b/tests/upgrades/test_capsule.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import os import pytest diff --git a/tests/upgrades/test_classparameter.py b/tests/upgrades/test_classparameter.py index b7f8d1c6ed1..f0fd73f78ad 100644 --- a/tests/upgrades/test_classparameter.py +++ b/tests/upgrades/test_classparameter.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import json import pytest diff --git a/tests/upgrades/test_client.py b/tests/upgrades/test_client.py index 8ca57aa4586..4313675a6c0 100644 --- a/tests/upgrades/test_client.py +++ b/tests/upgrades/test_client.py @@ -14,6 +14,7 @@ :CaseImportance: High """ + import pytest from robottelo.constants import FAKE_0_CUSTOM_PACKAGE_NAME, FAKE_4_CUSTOM_PACKAGE_NAME diff --git a/tests/upgrades/test_contentview.py b/tests/upgrades/test_contentview.py index 2b581297b1e..537ea003e03 100644 --- a/tests/upgrades/test_contentview.py +++ b/tests/upgrades/test_contentview.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_alpha import pytest diff --git a/tests/upgrades/test_discovery.py b/tests/upgrades/test_discovery.py index c85e02e01f4..1cf7404fb19 100644 --- a/tests/upgrades/test_discovery.py +++ b/tests/upgrades/test_discovery.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import re from packaging.version import Version diff --git a/tests/upgrades/test_errata.py b/tests/upgrades/test_errata.py index 90dec2b3058..1425d341158 100644 --- a/tests/upgrades/test_errata.py +++ b/tests/upgrades/test_errata.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest from wait_for import wait_for diff --git a/tests/upgrades/test_host.py b/tests/upgrades/test_host.py index b60585d63bd..b5db455ab33 100644 --- a/tests/upgrades/test_host.py +++ b/tests/upgrades/test_host.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/upgrades/test_hostcontent.py b/tests/upgrades/test_hostcontent.py index 0a6a60e2a9e..b8faff77feb 100644 --- a/tests/upgrades/test_hostcontent.py +++ b/tests/upgrades/test_hostcontent.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest diff --git a/tests/upgrades/test_hostgroup.py b/tests/upgrades/test_hostgroup.py index a6d67a106db..a61e854bc5c 100644 --- a/tests/upgrades/test_hostgroup.py +++ b/tests/upgrades/test_hostgroup.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/upgrades/test_performance_tuning.py b/tests/upgrades/test_performance_tuning.py index 33237e8f561..28a30aeed95 100644 --- a/tests/upgrades/test_performance_tuning.py +++ b/tests/upgrades/test_performance_tuning.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import filecmp import pytest diff --git a/tests/upgrades/test_provisioningtemplate.py b/tests/upgrades/test_provisioningtemplate.py index 7c603c30a53..cc686e3d22f 100644 --- a/tests/upgrades/test_provisioningtemplate.py +++ b/tests/upgrades/test_provisioningtemplate.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/upgrades/test_puppet.py b/tests/upgrades/test_puppet.py index b0c96394cc8..9c8f53fbbe1 100644 --- a/tests/upgrades/test_puppet.py +++ b/tests/upgrades/test_puppet.py @@ -11,6 +11,7 @@ :CaseImportance: Medium """ + import pytest diff --git a/tests/upgrades/test_remoteexecution.py b/tests/upgrades/test_remoteexecution.py index 6aeaecb8639..6eba06e1b73 100644 --- a/tests/upgrades/test_remoteexecution.py +++ b/tests/upgrades/test_remoteexecution.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest diff --git a/tests/upgrades/test_repository.py b/tests/upgrades/test_repository.py index 63f13197a9a..04c0a4952c2 100644 --- a/tests/upgrades/test_repository.py +++ b/tests/upgrades/test_repository.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/upgrades/test_role.py b/tests/upgrades/test_role.py index 25c0ab411c5..1af836c5bcb 100644 --- a/tests/upgrades/test_role.py +++ b/tests/upgrades/test_role.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest diff --git a/tests/upgrades/test_satellite_maintain.py b/tests/upgrades/test_satellite_maintain.py index 03abb569e94..128a6dd64b2 100644 --- a/tests/upgrades/test_satellite_maintain.py +++ b/tests/upgrades/test_satellite_maintain.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import re import pytest diff --git a/tests/upgrades/test_satellitesync.py b/tests/upgrades/test_satellitesync.py index ad9356d2f97..627f389ca1a 100644 --- a/tests/upgrades/test_satellitesync.py +++ b/tests/upgrades/test_satellitesync.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.constants import PULP_EXPORT_DIR diff --git a/tests/upgrades/test_subnet.py b/tests/upgrades/test_subnet.py index 0fbc2f38277..220b9316c79 100644 --- a/tests/upgrades/test_subnet.py +++ b/tests/upgrades/test_subnet.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest diff --git a/tests/upgrades/test_subscription.py b/tests/upgrades/test_subscription.py index dc6d33b84b2..cbf34dd05a6 100644 --- a/tests/upgrades/test_subscription.py +++ b/tests/upgrades/test_subscription.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from manifester import Manifester import pytest diff --git a/tests/upgrades/test_syncplan.py b/tests/upgrades/test_syncplan.py index 5939c8e16dc..0a9f1e8f787 100644 --- a/tests/upgrades/test_syncplan.py +++ b/tests/upgrades/test_syncplan.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_choice import pytest diff --git a/tests/upgrades/test_user.py b/tests/upgrades/test_user.py index b21da9b5ba1..bdcc3549739 100644 --- a/tests/upgrades/test_user.py +++ b/tests/upgrades/test_user.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest diff --git a/tests/upgrades/test_usergroup.py b/tests/upgrades/test_usergroup.py index 11ac95e2af8..36687f048db 100644 --- a/tests/upgrades/test_usergroup.py +++ b/tests/upgrades/test_usergroup.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/upgrades/test_virtwho.py b/tests/upgrades/test_virtwho.py index ca785ab0149..cf62e750d71 100644 --- a/tests/upgrades/test_virtwho.py +++ b/tests/upgrades/test_virtwho.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest @@ -170,7 +171,7 @@ def test_post_crud_virt_who_configuration(self, form_data, pre_upgrade_data, tar # Verify the virt-who config-file exists. config_file = get_configure_file(vhd.id) - get_configure_option('hypervisor_id', config_file), + get_configure_option('hypervisor_id', config_file) # Update virt-who config modify_name = gen_string('alpha')