From 8dc333de3cb3c6cdbc63474f6ce11ecb935a8729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Gajdu=C5=A1ek?= Date: Fri, 26 Apr 2024 11:47:05 +0200 Subject: [PATCH] Lint: Black -> Ruff formatter --- .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/rex_feature.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 | 2 + 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_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 | 47 ++++++++++--------- tests/foreman/api/test_filter.py | 1 + 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_notifications.py | 5 +- 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_capsulecontent.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 + .../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/longrun/test_remoteexecution.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/sys/test_webpack.py | 1 + tests/foreman/ui/test_acs.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_capsulecontent.py | 1 + tests/foreman/ui/test_computeprofiles.py | 1 + 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_contentview_old.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_eol_banner.py | 1 + tests/foreman/ui/test_errata.py | 23 ++++----- 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_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_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_search.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 +- 446 files changed, 589 insertions(+), 179 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 7645728a06c..f50f81e2975 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 d2bbb4cce39..89dcbb2dfa8 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 d276cd741fa..04ad7a14882 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 bb6825cc783..c5ba0ec8918 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 17732f37617..57d69b7dd29 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 4e35b0c7612..171cba6c0e3 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 dc45c9db887..6f093071704 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 fe02dae4d74..8e8e37baca8 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 50646e3cd4b..5f66c1ee64f 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 d5ac3caf7a1..a17cc9fbcba 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/rex_feature.py b/robottelo/cli/rex_feature.py index 354fdc51ffe..b583a9e3536 100644 --- a/robottelo/cli/rex_feature.py +++ b/robottelo/cli/rex_feature.py @@ -15,6 +15,7 @@ update Update a job template """ + 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 4c2b4ffb33d..1227a06bbe4 100644 --- a/robottelo/cli/sm_advanced.py +++ b/robottelo/cli/sm_advanced.py @@ -81,6 +81,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 ef703134cfa..0b60ef52742 100644 --- a/robottelo/cli/sm_backup.py +++ b/robottelo/cli/sm_backup.py @@ -13,6 +13,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 9894335ab05..b4f59d3eede 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 9b861dbf9a9..7d0a73dadf5 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 eb37133e786..52dc7233f52 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 f29ad3f5573..71344fc3717 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 ea37b6c7779..a9c311fc60b 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 78d32535efc..9daf785974a 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 @@ -2078,6 +2079,7 @@ class Colored(Box): EXPIRED_MANIFEST = 'expired-manifest.zip' + # Data File Paths class DataFile(Box): """The boxed Data directory class with its attributes pointing to the Data directory files""" 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 df7085e0d02..6bd9cd8365c 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 from datetime import datetime import time diff --git a/robottelo/host_helpers/cli_factory.py b/robottelo/host_helpers/cli_factory.py index cc325002229..4e62d3d0708 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 3b01ef2dfff..c76d23405fe 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 0ff2bdecd68..a55bc53ff85 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 @@ -509,7 +510,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 d20a70d2d15..58fe5b5d237 100644 --- a/robottelo/host_helpers/satellite_mixins.py +++ b/robottelo/host_helpers/satellite_mixins.py @@ -308,7 +308,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 445cafc82b7..c4caec79246 100644 --- a/robottelo/hosts.py +++ b/robottelo/hosts.py @@ -63,7 +63,7 @@ POWER_OPERATIONS = { VmState.RUNNING: 'running', VmState.STOPPED: 'stopped', - 'reboot': 'reboot' + 'reboot': 'reboot', # TODO paused, suspended, shelved? } @@ -837,10 +837,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 1834e0f87b0..ae52d8fd740 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 ef5add381fc..36ee295ef9a 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 435501d0696..71d47b860d2 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 a90eda83884..430657d9c8e 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_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 2cbeaf50860..9ebab16223e 100644 --- a/tests/foreman/api/test_contentview.py +++ b/tests/foreman/api/test_contentview.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime, timedelta import random diff --git a/tests/foreman/api/test_contentviewfilter.py b/tests/foreman/api/test_contentviewfilter.py index 6360bf5da16..0516582ed5e 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 c78d06f0acc..a5dece8f718 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 59783b9a8b6..06139e8cc65 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 81974401a9f..0751dc5bdce 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, time @@ -122,8 +123,7 @@ def _validate_errata_counts(host, errata_type, expected_value, timeout=120): 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, @@ -149,8 +149,7 @@ def _fetch_available_errata(host, expected_amount=None, timeout=120): errata = host.errata() else: pytest.fail( - 'Host {} contains {} available errata, but expected to ' - 'contain {} of them'.format( + 'Host {} contains {} available errata, but expected to ' 'contain {} of them'.format( host.name, len(errata['results']), expected_amount if not None else 'No expected_amount provided', @@ -400,7 +399,7 @@ def package_applicability_changed_as_expected( output = host.execute(f'rpm -q {package_basename}').stdout current_package = output[:-1] assert package_basename in current_package - if current_package == package_filename: + if current_package == package_filename: # noqa: SIM108 # we have already checked if applicable package count changed, # in case the same version as prior was installed and present. prior_package = None # package must not have been present before this modification @@ -495,13 +494,16 @@ def _publish_and_wait(sat, org, cv, search_rate=1, max_tries=10): task_id = sat.api.ContentView(id=cv.id).publish({'id': cv.id, 'organization': org})['id'] assert task_id, f'No task was invoked to publish the Content-View: {cv.id}.' # Should take < 1 minute, check in 5s intervals - sat.wait_for_tasks( - search_query=(f'label = Actions::Katello::ContentView::Publish and id = {task_id}'), - search_rate=search_rate, - max_tries=max_tries, - ), ( - f'Failed to publish the Content-View: {cv.id}, in time.' - f'Task: {task_id} failed, or timed out ({search_rate*max_tries}s).' + ( + sat.wait_for_tasks( + search_query=(f'label = Actions::Katello::ContentView::Publish and id = {task_id}'), + search_rate=search_rate, + max_tries=max_tries, + ), + ( + f'Failed to publish the Content-View: {cv.id}, in time.' + f'Task: {task_id} failed, or timed out ({search_rate*max_tries}s).' + ), ) @@ -623,13 +625,16 @@ def test_positive_install_in_hc( 'organization_id': module_sca_manifest_org.id, }, )['id'] - target_sat.wait_for_tasks( - search_query=(f'label = Actions::RemoteExecution::RunHostsJob and id = {task_id}'), - search_rate=15, - max_tries=10, - ), ( - f'Could not install erratum: {CUSTOM_REPO_ERRATA_ID}, to Host-Collection.' - f' Task: {task_id} failed, or timed out.' + ( + target_sat.wait_for_tasks( + search_query=(f'label = Actions::RemoteExecution::RunHostsJob and id = {task_id}'), + search_rate=15, + max_tries=10, + ), + ( + f'Could not install erratum: {CUSTOM_REPO_ERRATA_ID}, to Host-Collection.' + f' Task: {task_id} failed, or timed out.' + ), ) for client in content_hosts: # No applicable errata after install on all clients @@ -928,8 +933,8 @@ def test_positive_install_multiple_in_host( f' but installed {len(updated_packages)}.' ) # Check sets of installed package filename(s) strings, matches expected - assert set(updated_packages) == set( - security_packages_to_install + assert ( + set(updated_packages) == set(security_packages_to_install) ), 'Expected package version filename(s) and installed package version filenam(s) are not the same.' diff --git a/tests/foreman/api/test_filter.py b/tests/foreman/api/test_filter.py index d13d5a7ecad..b676a67c6da 100644 --- a/tests/foreman/api/test_filter.py +++ b/tests/foreman/api/test_filter.py @@ -15,6 +15,7 @@ :CaseImportance: High """ + import pytest from requests.exceptions import HTTPError 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 eb3e89dc6aa..e8982215ad7 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 1bd00051e67..4d4b3faf8f9 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_notifications.py b/tests/foreman/api/test_notifications.py index f2477ad3291..ebb1e1771ef 100644 --- a/tests/foreman/api/test_notifications.py +++ b/tests/foreman/api/test_notifications.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from mailbox import mbox from re import findall from tempfile import mkstemp @@ -231,14 +232,14 @@ def long_running_task(target_sat): 'password': settings.server.ssh_password, }, ) - sql_date_2_days_ago = "now() - INTERVAL \'2 days\'" + sql_date_2_days_ago = "now() - INTERVAL '2 days'" result = target_sat.execute( "su - postgres -c \"psql foreman postgres <> {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 5e0ca29eec6..7d9cf6ce70a 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_capsulecontent.py b/tests/foreman/cli/test_capsulecontent.py index 73e42659fa2..a75ffbb1aed 100644 --- a/tests/foreman/cli/test_capsulecontent.py +++ b/tests/foreman/cli/test_capsulecontent.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings 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 62ee4a71505..da69418eecd 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 c2de286b9f6..33a18149335 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 65ffeb940a5..0a198b2754c 100644 --- a/tests/foreman/cli/test_contentviewfilter.py +++ b/tests/foreman/cli/test_contentviewfilter.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from fauxfactory import gen_string 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 0dc3e091654..881f95a1c7e 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 import re 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 aa3bfcf4aeb..bc78daa88c0 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 fe01b0bc973..2935e605ab3 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 febe94038f8..dee6662a950 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 cf0eb838ee0..a31ad211237 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 e3cb8bb32ab..f87695dd587 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 9f835c1c581..eff9220f149 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 bb7daceb606..c4bf8602e04 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 @@ -242,7 +243,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 da79144f141..eded57e07ef 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 588fd2371ff..ea0f15318a1 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 1036b3c5fd9..0d6b6929c25 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 e6480abd3a7..7250fb4f0c2 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 34f3fb7f7b6..95f74e1468c 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 c5a353395b7..9cfc8608bee 100644 --- a/tests/foreman/cli/test_remoteexecution.py +++ b/tests/foreman/cli/test_remoteexecution.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from calendar import monthrange from datetime import datetime, timedelta import random 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 9c9bcf0e5a6..b1a92d67049 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 fdbe9948b09..f7f4fdafdb9 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 6d612029d15..9d3bad40467 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 ed84fd465d7..d8fbb53adbf 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 09ff7391a22..2884fbfea49 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 c28ba08e61a..bb48c6148f7 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 manifester import Manifester from nailgun import entities diff --git a/tests/foreman/cli/test_syncplan.py b/tests/foreman/cli/test_syncplan.py index 129686447f4..eecf7c5f37b 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 b0cc31b2003..4d8aa850373 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 3646e301db0..8b9c2b97147 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 eb5a38a09f0..3443efb2bc8 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 06a59097434..cf218def68e 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 cf36aac8a9f..f9b3bbbf8d7 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 d060ae29c78..16240f6546b 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 1ad4cd25f20..e435f3fbfcf 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 c098f86c065..23f8ea71002 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 d6b39f7556b..6e7f48d8fc8 100644 --- a/tests/foreman/destructive/test_contentview.py +++ b/tests/foreman/destructive/test_contentview.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import random from time import sleep 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 cb3aad76c75..e3e7c3409cd 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 36776213c13..8c61633fc53 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_certs_check.py b/tests/foreman/destructive/test_katello_certs_check.py index ce42047973a..2d629e9f38b 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 9022b4fec86..8d673b94645 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 da9c15f6515..c7098c98924 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 9bd118ac4e7..3411f13000d 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 cbddcdc3bc8..7ee6f519037 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 cede80dfecb..57562c6cb9e 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 dc44d6691f7..789b0bf4d18 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 696e05f52e2..ae8ce8d3009 100644 --- a/tests/foreman/installer/test_installer.py +++ b/tests/foreman/installer/test_installer.py @@ -11,6 +11,7 @@ :CaseImportance: Critical """ + import pytest import requests import yaml diff --git a/tests/foreman/longrun/test_inc_updates.py b/tests/foreman/longrun/test_inc_updates.py index 693f9441e45..3f00f09662e 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 53777de356b..aaaa127a098 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/longrun/test_remoteexecution.py b/tests/foreman/longrun/test_remoteexecution.py index abff4966d7a..14c75f1cec7 100644 --- a/tests/foreman/longrun/test_remoteexecution.py +++ b/tests/foreman/longrun/test_remoteexecution.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest 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 4abe8aa0391..0ddbfb18b93 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)] @@ -402,7 +403,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)] @@ -488,7 +489,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)] @@ -572,7 +573,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( @@ -591,7 +592,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 9ba117f72cf..b5bb4e6f511 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 3ff33790055..e35a55d9e00 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 2a0f1a28ca8..4f17592629d 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 2b758bcb208..c93f3475d29 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 f4500a2b599..e4675d4f581 100644 --- a/tests/foreman/sys/test_fam.py +++ b/tests/foreman/sys/test_fam.py @@ -11,6 +11,7 @@ :Team: Platform """ + from broker import Broker import pytest diff --git a/tests/foreman/sys/test_katello_certs_check.py b/tests/foreman/sys/test_katello_certs_check.py index 820501f3713..fc8da2802c0 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/sys/test_webpack.py b/tests/foreman/sys/test_webpack.py index c71e9016e97..df08627d29c 100644 --- a/tests/foreman/sys/test_webpack.py +++ b/tests/foreman/sys/test_webpack.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest diff --git a/tests/foreman/ui/test_acs.py b/tests/foreman/ui/test_acs.py index 40da1c22002..da5a3c144e9 100644 --- a/tests/foreman/ui/test_acs.py +++ b/tests/foreman/ui/test_acs.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo import constants diff --git a/tests/foreman/ui/test_activationkey.py b/tests/foreman/ui/test_activationkey.py index 7630a1761b9..98cf3cffa4b 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 c538ef099e1..23edf4f2d96 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 from wait_for import wait_for @@ -182,7 +183,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 e6448f4442d..54dc1be1f9e 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 import pytest diff --git a/tests/foreman/ui/test_audit.py b/tests/foreman/ui/test_audit.py index b7d0ce6344f..9c5cc172506 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 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_capsulecontent.py b/tests/foreman/ui/test_capsulecontent.py index 43fc34b430f..53d08b68411 100644 --- a/tests/foreman/ui/test_capsulecontent.py +++ b/tests/foreman/ui/test_capsulecontent.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings diff --git a/tests/foreman/ui/test_computeprofiles.py b/tests/foreman/ui/test_computeprofiles.py index dfe73935f3e..0f0cb99c1ea 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 import pytest diff --git a/tests/foreman/ui/test_computeresource.py b/tests/foreman/ui/test_computeresource.py index abbc088aa47..b39cc00e3a6 100644 --- a/tests/foreman/ui/test_computeresource.py +++ b/tests/foreman/ui/test_computeresource.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from wait_for import wait_for @@ -288,7 +289,6 @@ def test_positive_VM_import(session, module_org, module_location, rhev_data, mod 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 0d08685543c..1dae4eb7492 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 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 4c9516e9cd6..881ca3c8eaa 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 41f8960d96d..9d8892e67ba 100644 --- a/tests/foreman/ui/test_containerimagetag.py +++ b/tests/foreman/ui/test_containerimagetag.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.constants import ( 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 5f351076e5b..fc4071412b2 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 @@ -1773,7 +1774,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'] @@ -1811,8 +1812,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 625d5fb927a..0d203fc7707 100644 --- a/tests/foreman/ui/test_contentview.py +++ b/tests/foreman/ui/test_contentview.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from fauxfactory import gen_string import pytest diff --git a/tests/foreman/ui/test_contentview_old.py b/tests/foreman/ui/test_contentview_old.py index 0bff1edfb8e..ce20ed0aecd 100644 --- a/tests/foreman/ui/test_contentview_old.py +++ b/tests/foreman/ui/test_contentview_old.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 9788e1c6f31..071e44cc4d7 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 4a116f762f0..51a8a048c54 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 import pytest diff --git a/tests/foreman/ui/test_eol_banner.py b/tests/foreman/ui/test_eol_banner.py index c19b19838e6..cc3c46eadf0 100644 --- a/tests/foreman/ui/test_eol_banner.py +++ b/tests/foreman/ui/test_eol_banner.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime, timedelta from airgun.session import Session diff --git a/tests/foreman/ui/test_errata.py b/tests/foreman/ui/test_errata.py index dadcaf6bef9..43aed0bd88c 100644 --- a/tests/foreman/ui/test_errata.py +++ b/tests/foreman/ui/test_errata.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from datetime import datetime from broker import Broker @@ -163,10 +164,7 @@ def cv_publish_promote(sat, org, cv, lce=None, needs_publish=True): # Take a single instance of lce, or list of instances lce_ids = 'Library' if lce is not None: - if not isinstance(lce, list): - lce_ids = [lce.id] - else: - lce_ids = sorted(_lce.id for _lce in lce) + lce_ids = [lce.id] if not isinstance(lce, list) else sorted(_lce.id for _lce in lce) if needs_publish is True: _publish_and_wait(sat, org, cv) @@ -198,13 +196,16 @@ def _publish_and_wait(sat, org, cv): task_id = sat.api.ContentView(id=cv.id).publish({'id': cv.id, 'organization': org})['id'] assert task_id, f'No task was invoked to publish the Content-View: {cv.id}.' # Should take < 1 minute, check in 5s intervals - sat.wait_for_tasks( - search_query=(f'label = Actions::Katello::ContentView::Publish and id = {task_id}'), - search_rate=5, - max_tries=12, - ), ( - f'Failed to publish the Content-View: {cv.id}, in time.' - f'Task: {task_id} failed, or timed out (60s).' + ( + sat.wait_for_tasks( + search_query=(f'label = Actions::Katello::ContentView::Publish and id = {task_id}'), + search_rate=5, + max_tries=12, + ), + ( + f'Failed to publish the Content-View: {cv.id}, in time.' + f'Task: {task_id} failed, or timed out (60s).' + ), ) diff --git a/tests/foreman/ui/test_hardwaremodel.py b/tests/foreman/ui/test_hardwaremodel.py index c2733d17d35..262bb567cee 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 import pytest diff --git a/tests/foreman/ui/test_host.py b/tests/foreman/ui/test_host.py index 7fec6db1f7d..933c4b835b6 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 91c76c55364..49ea829f4ba 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 46d167194f7..3a7c8aeb582 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 import pytest diff --git a/tests/foreman/ui/test_http_proxy.py b/tests/foreman/ui/test_http_proxy.py index 10d2249be30..625b4c6af3a 100644 --- a/tests/foreman/ui/test_http_proxy.py +++ b/tests/foreman/ui/test_http_proxy.py @@ -11,6 +11,7 @@ :CaseAutomation: Automated """ + from box import Box from fauxfactory import gen_integer, gen_string, gen_url import pytest diff --git a/tests/foreman/ui/test_jobtemplate.py b/tests/foreman/ui/test_jobtemplate.py index e2be74da640..c4ad3fa6ccb 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 554244957fe..0fec6fba27a 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 2ddb1620b2f..123673b6692 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 import pytest diff --git a/tests/foreman/ui/test_media.py b/tests/foreman/ui/test_media.py index 75a39f80edb..5c41ab40676 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 8bdd808ec6c..6d782f1616b 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 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 7b200391f77..cbbc6532088 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 import pytest diff --git a/tests/foreman/ui/test_oscappolicy.py b/tests/foreman/ui/test_oscappolicy.py index bbfc9492c78..7f0e98e0014 100644 --- a/tests/foreman/ui/test_oscappolicy.py +++ b/tests/foreman/ui/test_oscappolicy.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.constants import OSCAP_PROFILE diff --git a/tests/foreman/ui/test_oscaptailoringfile.py b/tests/foreman/ui/test_oscaptailoringfile.py index 0145ac250cc..346db2c10e7 100644 --- a/tests/foreman/ui/test_oscaptailoringfile.py +++ b/tests/foreman/ui/test_oscaptailoringfile.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + import pytest from robottelo.utils.datafactory import gen_string diff --git a/tests/foreman/ui/test_package.py b/tests/foreman/ui/test_package.py index 9d6e91a9ab8..8dadbfe2d01 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 import pytest diff --git a/tests/foreman/ui/test_partitiontable.py b/tests/foreman/ui/test_partitiontable.py index 127dc1ec67f..b8f0416331f 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 88f2eb1e521..4fd89223523 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 9d223340a35..65c79b8163c 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 @@ -540,7 +541,6 @@ def test_positive_host_registration_with_non_admin_user( with module_target_sat.ui_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 e34f49772af..51f8d4f3dda 100644 --- a/tests/foreman/ui/test_remoteexecution.py +++ b/tests/foreman/ui/test_remoteexecution.py @@ -11,6 +11,7 @@ :CaseImportance: High """ + from collections import OrderedDict import datetime import time diff --git a/tests/foreman/ui/test_reporttemplates.py b/tests/foreman/ui/test_reporttemplates.py index fe833d683fb..79a4424007a 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 d75f456cf78..081c2d96fd8 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 8522e03a4de..50d0dfb6b87 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 652bdcbd4f6..6a93789f6aa 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_search.py b/tests/foreman/ui/test_search.py index cc9120bfc2b..df58459e2a1 100644 --- a/tests/foreman/ui/test_search.py +++ b/tests/foreman/ui/test_search.py @@ -10,6 +10,7 @@ :CaseImportance: Medium """ + from collections import namedtuple from fauxfactory import gen_string diff --git a/tests/foreman/ui/test_settings.py b/tests/foreman/ui/test_settings.py index c3c233bf97e..fee05bee938 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 45bfcd47d91..4157d6c5e47 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 44cfc7483b8..2a62030af7f 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 import pytest diff --git a/tests/foreman/ui/test_syncplan.py b/tests/foreman/ui/test_syncplan.py index 70a2a31a81c..b4be83f7141 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 766608cd306..e76444ee4a0 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 import pytest import requests diff --git a/tests/foreman/ui/test_user.py b/tests/foreman/ui/test_user.py index 72e56d8241d..0130409eab3 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 a3196188f40..46e20ffe7ad 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 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 c18ffb3ab30..0b148edbfc4 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 @@ -410,9 +411,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 6b15b6803f9..a6c2e4843e2 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 @@ -492,9 +493,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 a5b560c99a1..5fcd47bdb88 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-subscriptions """ + 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 a1554929866..14714df675d 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-subscriptions """ + 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 ffef902441e..66c73926ab8 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-subscriptions """ + 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 c89496485be..94fc71d1de9 100644 --- a/tests/upgrades/test_client.py +++ b/tests/upgrades/test_client.py @@ -14,6 +14,7 @@ :CaseImportance: High """ + import pytest from robottelo.config import settings 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 31233d820c6..9b4de62f02f 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 c2ee4b25d20..7140ea9191e 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 e86868ebf37..be9f95d3bd6 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 @@ -148,7 +149,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),) # Verify Report is sent to satellite. command = get_configure_command(vhd.id, org=org_name)