From df2ae06d46f34623b79357b1fa35ff52c16b785b Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Wed, 5 May 2021 14:29:30 -0700 Subject: [PATCH] Fix ansible-test imports and paths after refactor. Also include a changelog entry covering this commit and the previous. --- .../ansible-test-refactor-commands.yml | 2 ++ .../ansible_test/_internal/classification.py | 6 ++-- test/lib/ansible_test/_internal/cli.py | 30 +++++++++---------- .../_internal/commands/__init__.py | 0 .../_internal/commands/coverage/__init__.py | 18 +++++------ .../commands/coverage/analyze/__init__.py | 2 +- .../coverage/analyze/targets/__init__.py | 6 ++-- .../coverage/analyze/targets/combine.py | 2 +- .../coverage/analyze/targets/expand.py | 4 +-- .../coverage/analyze/targets/filter.py | 2 +- .../coverage/analyze/targets/generate.py | 8 ++--- .../coverage/analyze/targets/missing.py | 4 +-- .../_internal/commands/coverage/combine.py | 8 ++--- .../_internal/commands/coverage/erase.py | 2 +- .../_internal/commands/coverage/html.py | 6 ++-- .../_internal/commands/coverage/report.py | 6 ++-- .../_internal/commands/coverage/xml.py | 8 ++--- .../_internal/commands/env/__init__.py | 18 +++++------ .../commands/integration/__init__.py | 22 +++++++------- .../commands/integration/cloud/__init__.py | 22 +++++++------- .../commands/integration/cloud/acme.py | 4 +-- .../commands/integration/cloud/aws.py | 10 +++---- .../commands/integration/cloud/azure.py | 14 ++++----- .../commands/integration/cloud/cloudscale.py | 4 +-- .../commands/integration/cloud/cs.py | 12 ++++---- .../commands/integration/cloud/foreman.py | 4 +-- .../commands/integration/cloud/galaxy.py | 6 ++-- .../commands/integration/cloud/gcp.py | 4 +-- .../commands/integration/cloud/hcloud.py | 10 +++---- .../commands/integration/cloud/httptester.py | 6 ++-- .../commands/integration/cloud/nios.py | 4 +-- .../commands/integration/cloud/opennebula.py | 2 +- .../commands/integration/cloud/openshift.py | 8 ++--- .../commands/integration/cloud/scaleway.py | 4 +-- .../commands/integration/cloud/vcenter.py | 6 ++-- .../commands/integration/cloud/vultr.py | 4 +-- .../_internal/commands/sanity/__init__.py | 24 +++++++-------- .../_internal/commands/sanity/ansible_doc.py | 18 +++++------ .../_internal/commands/sanity/bin_symlinks.py | 12 ++++---- .../_internal/commands/sanity/compile.py | 12 ++++---- .../_internal/commands/sanity/ignores.py | 6 ++-- .../_internal/commands/sanity/import.py | 22 +++++++------- .../commands/sanity/integration_aliases.py | 16 +++++----- .../_internal/commands/sanity/pep8.py | 12 ++++---- .../_internal/commands/sanity/pslint.py | 14 ++++----- .../_internal/commands/sanity/pylint.py | 16 +++++----- .../_internal/commands/sanity/sanity_docs.py | 6 ++-- .../_internal/commands/sanity/shellcheck.py | 12 ++++---- .../commands/sanity/validate_modules.py | 18 +++++------ .../_internal/commands/sanity/yamllint.py | 20 +++++++------ .../_internal/commands/units/__init__.py | 20 ++++++------- test/lib/ansible_test/_internal/executor.py | 4 +-- 52 files changed, 257 insertions(+), 253 deletions(-) create mode 100644 changelogs/fragments/ansible-test-refactor-commands.yml create mode 100644 test/lib/ansible_test/_internal/commands/__init__.py diff --git a/changelogs/fragments/ansible-test-refactor-commands.yml b/changelogs/fragments/ansible-test-refactor-commands.yml new file mode 100644 index 00000000000..30654864078 --- /dev/null +++ b/changelogs/fragments/ansible-test-refactor-commands.yml @@ -0,0 +1,2 @@ +minor_changes: + - ansible-test - Reorganize code for individual commands. diff --git a/test/lib/ansible_test/_internal/classification.py b/test/lib/ansible_test/_internal/classification.py index ff44b804533..b94dbf45828 100644 --- a/test/lib/ansible_test/_internal/classification.py +++ b/test/lib/ansible_test/_internal/classification.py @@ -789,7 +789,7 @@ class PathMapper: if path == 'test/lib/ansible_test/_data/completion/docker.txt': return all_tests(self.args, force=True) # force all tests due to risk of breaking changes in new test environment - if path.startswith('test/lib/ansible_test/_internal/cloud/'): + if path.startswith('test/lib/ansible_test/_internal/commands/integration/cloud/'): cloud_target = 'cloud/%s/' % name if cloud_target in self.integration_targets_by_alias: @@ -799,7 +799,7 @@ class PathMapper: return all_tests(self.args) # test infrastructure, run all tests - if path.startswith('test/lib/ansible_test/_internal/sanity/'): + if path.startswith('test/lib/ansible_test/_internal/commands/sanity/'): return { 'sanity': 'all', # test infrastructure, run all sanity checks 'integration': 'ansible-test', # run ansible-test self tests @@ -811,7 +811,7 @@ class PathMapper: 'integration': 'ansible-test', # run ansible-test self tests } - if path.startswith('test/lib/ansible_test/_internal/units/'): + if path.startswith('test/lib/ansible_test/_internal/commands/units/'): return { 'units': 'all', # test infrastructure, run all unit tests 'integration': 'ansible-test', # run ansible-test self tests diff --git a/test/lib/ansible_test/_internal/cli.py b/test/lib/ansible_test/_internal/cli.py index fc360b30675..dce977c53d6 100644 --- a/test/lib/ansible_test/_internal/cli.py +++ b/test/lib/ansible_test/_internal/cli.py @@ -51,19 +51,19 @@ from .config import ( ShellConfig, ) -from .env import ( +from .commands.env import ( EnvConfig, command_env, configure_timeout, ) -from .sanity import ( +from .commands.sanity import ( command_sanity, sanity_init, sanity_get_tests, ) -from .units import ( +from .commands.units import ( command_units, ) @@ -76,7 +76,7 @@ from .target import ( walk_sanity_targets, ) -from .cloud import ( +from .commands.integration.cloud import ( initialize_cloud_plugins, ) @@ -95,53 +95,53 @@ from .util_common import ( CommonConfig, ) -from .coverage.combine import ( +from .commands.coverage.combine import ( command_coverage_combine, ) -from .coverage.erase import ( +from .commands.coverage.erase import ( command_coverage_erase, ) -from .coverage.html import ( +from .commands.coverage.html import ( command_coverage_html, ) -from .coverage.report import ( +from .commands.coverage.report import ( command_coverage_report, CoverageReportConfig, ) -from .coverage.xml import ( +from .commands.coverage.xml import ( command_coverage_xml, ) -from .coverage.analyze.targets.generate import ( +from .commands.coverage.analyze.targets.generate import ( command_coverage_analyze_targets_generate, CoverageAnalyzeTargetsGenerateConfig, ) -from .coverage.analyze.targets.expand import ( +from .commands.coverage.analyze.targets.expand import ( command_coverage_analyze_targets_expand, CoverageAnalyzeTargetsExpandConfig, ) -from .coverage.analyze.targets.filter import ( +from .commands.coverage.analyze.targets.filter import ( command_coverage_analyze_targets_filter, CoverageAnalyzeTargetsFilterConfig, ) -from .coverage.analyze.targets.combine import ( +from .commands.coverage.analyze.targets.combine import ( command_coverage_analyze_targets_combine, CoverageAnalyzeTargetsCombineConfig, ) -from .coverage.analyze.targets.missing import ( +from .commands.coverage.analyze.targets.missing import ( command_coverage_analyze_targets_missing, CoverageAnalyzeTargetsMissingConfig, ) -from .coverage import ( +from .commands.coverage import ( COVERAGE_GROUPS, CoverageConfig, ) diff --git a/test/lib/ansible_test/_internal/commands/__init__.py b/test/lib/ansible_test/_internal/commands/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/lib/ansible_test/_internal/commands/coverage/__init__.py b/test/lib/ansible_test/_internal/commands/coverage/__init__.py index d412c38d27b..e21c302486e 100644 --- a/test/lib/ansible_test/_internal/commands/coverage/__init__.py +++ b/test/lib/ansible_test/_internal/commands/coverage/__init__.py @@ -6,43 +6,43 @@ import errno import os import re -from .. import types as t +from ... import types as t -from ..encoding import ( +from ...encoding import ( to_bytes, ) -from ..io import ( +from ...io import ( open_binary_file, read_json_file, ) -from ..util import ( +from ...util import ( ApplicationError, common_environment, display, ANSIBLE_TEST_DATA_ROOT, ) -from ..util_common import ( +from ...util_common import ( intercept_command, ResultType, ) -from ..config import ( +from ...config import ( EnvironmentConfig, ) -from ..executor import ( +from ...executor import ( Delegate, install_command_requirements, ) -from .. target import ( +from ... target import ( walk_module_targets, ) -from ..data import ( +from ...data import ( data_context, ) diff --git a/test/lib/ansible_test/_internal/commands/coverage/analyze/__init__.py b/test/lib/ansible_test/_internal/commands/coverage/analyze/__init__.py index 457703731d1..103164494fd 100644 --- a/test/lib/ansible_test/_internal/commands/coverage/analyze/__init__.py +++ b/test/lib/ansible_test/_internal/commands/coverage/analyze/__init__.py @@ -2,7 +2,7 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -from ... import types as t +from .... import types as t from .. import ( CoverageConfig, diff --git a/test/lib/ansible_test/_internal/commands/coverage/analyze/targets/__init__.py b/test/lib/ansible_test/_internal/commands/coverage/analyze/targets/__init__.py index 8fe571b8777..ec0bef78cd1 100644 --- a/test/lib/ansible_test/_internal/commands/coverage/analyze/targets/__init__.py +++ b/test/lib/ansible_test/_internal/commands/coverage/analyze/targets/__init__.py @@ -4,14 +4,14 @@ __metaclass__ = type import os -from .... import types as t +from ..... import types as t -from ....io import ( +from .....io import ( read_json_file, write_json_file, ) -from ....util import ( +from .....util import ( ApplicationError, display, ) diff --git a/test/lib/ansible_test/_internal/commands/coverage/analyze/targets/combine.py b/test/lib/ansible_test/_internal/commands/coverage/analyze/targets/combine.py index 35148ff6ad6..7d9f18d433b 100644 --- a/test/lib/ansible_test/_internal/commands/coverage/analyze/targets/combine.py +++ b/test/lib/ansible_test/_internal/commands/coverage/analyze/targets/combine.py @@ -2,7 +2,7 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -from .... import types as t +from ..... import types as t from . import ( CoverageAnalyzeTargetsConfig, diff --git a/test/lib/ansible_test/_internal/commands/coverage/analyze/targets/expand.py b/test/lib/ansible_test/_internal/commands/coverage/analyze/targets/expand.py index 388dd6cb6dd..491650d8b30 100644 --- a/test/lib/ansible_test/_internal/commands/coverage/analyze/targets/expand.py +++ b/test/lib/ansible_test/_internal/commands/coverage/analyze/targets/expand.py @@ -2,9 +2,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -from .... import types as t +from ..... import types as t -from ....io import ( +from .....io import ( SortedSetEncoder, write_json_file, ) diff --git a/test/lib/ansible_test/_internal/commands/coverage/analyze/targets/filter.py b/test/lib/ansible_test/_internal/commands/coverage/analyze/targets/filter.py index e90fb2277e6..c7ea5810feb 100644 --- a/test/lib/ansible_test/_internal/commands/coverage/analyze/targets/filter.py +++ b/test/lib/ansible_test/_internal/commands/coverage/analyze/targets/filter.py @@ -4,7 +4,7 @@ __metaclass__ = type import re -from .... import types as t +from ..... import types as t from . import ( CoverageAnalyzeTargetsConfig, diff --git a/test/lib/ansible_test/_internal/commands/coverage/analyze/targets/generate.py b/test/lib/ansible_test/_internal/commands/coverage/analyze/targets/generate.py index a14b6f55993..d9f292785a1 100644 --- a/test/lib/ansible_test/_internal/commands/coverage/analyze/targets/generate.py +++ b/test/lib/ansible_test/_internal/commands/coverage/analyze/targets/generate.py @@ -4,17 +4,17 @@ __metaclass__ = type import os -from .... import types as t +from ..... import types as t -from ....encoding import ( +from .....encoding import ( to_text, ) -from ....data import ( +from .....data import ( data_context, ) -from ....util_common import ( +from .....util_common import ( ResultType, ) diff --git a/test/lib/ansible_test/_internal/commands/coverage/analyze/targets/missing.py b/test/lib/ansible_test/_internal/commands/coverage/analyze/targets/missing.py index 613a0ef275d..e0310ff2270 100644 --- a/test/lib/ansible_test/_internal/commands/coverage/analyze/targets/missing.py +++ b/test/lib/ansible_test/_internal/commands/coverage/analyze/targets/missing.py @@ -4,9 +4,9 @@ __metaclass__ = type import os -from .... import types as t +from ..... import types as t -from ....encoding import ( +from .....encoding import ( to_bytes, ) diff --git a/test/lib/ansible_test/_internal/commands/coverage/combine.py b/test/lib/ansible_test/_internal/commands/coverage/combine.py index 7f726267f66..ffc6351506d 100644 --- a/test/lib/ansible_test/_internal/commands/coverage/combine.py +++ b/test/lib/ansible_test/_internal/commands/coverage/combine.py @@ -4,20 +4,20 @@ __metaclass__ = type import os -from ..target import ( +from ...target import ( walk_compile_targets, walk_powershell_targets, ) -from ..io import ( +from ...io import ( read_text_file, ) -from ..util import ( +from ...util import ( display, ) -from ..util_common import ( +from ...util_common import ( ResultType, write_json_file, write_json_test_results, diff --git a/test/lib/ansible_test/_internal/commands/coverage/erase.py b/test/lib/ansible_test/_internal/commands/coverage/erase.py index 92d241c7fb2..7ba9608dfbc 100644 --- a/test/lib/ansible_test/_internal/commands/coverage/erase.py +++ b/test/lib/ansible_test/_internal/commands/coverage/erase.py @@ -4,7 +4,7 @@ __metaclass__ = type import os -from ..util_common import ( +from ...util_common import ( ResultType, ) diff --git a/test/lib/ansible_test/_internal/commands/coverage/html.py b/test/lib/ansible_test/_internal/commands/coverage/html.py index 63956a1966b..717f237d0e6 100644 --- a/test/lib/ansible_test/_internal/commands/coverage/html.py +++ b/test/lib/ansible_test/_internal/commands/coverage/html.py @@ -4,15 +4,15 @@ __metaclass__ = type import os -from ..io import ( +from ...io import ( make_dirs, ) -from ..util import ( +from ...util import ( display, ) -from ..util_common import ( +from ...util_common import ( ResultType, ) diff --git a/test/lib/ansible_test/_internal/commands/coverage/report.py b/test/lib/ansible_test/_internal/commands/coverage/report.py index 24efa637175..ae13b0db500 100644 --- a/test/lib/ansible_test/_internal/commands/coverage/report.py +++ b/test/lib/ansible_test/_internal/commands/coverage/report.py @@ -4,15 +4,15 @@ __metaclass__ = type import os -from ..io import ( +from ...io import ( read_json_file, ) -from ..util import ( +from ...util import ( display, ) -from ..data import ( +from ...data import ( data_context, ) diff --git a/test/lib/ansible_test/_internal/commands/coverage/xml.py b/test/lib/ansible_test/_internal/commands/coverage/xml.py index 94b5abc5954..b02520ec5b9 100644 --- a/test/lib/ansible_test/_internal/commands/coverage/xml.py +++ b/test/lib/ansible_test/_internal/commands/coverage/xml.py @@ -16,21 +16,21 @@ from xml.dom import ( minidom, ) -from ..io import ( +from ...io import ( make_dirs, read_json_file, ) -from ..util_common import ( +from ...util_common import ( ResultType, write_text_test_results, ) -from ..env import ( +from ...util import ( get_ansible_version, ) -from ..data import ( +from ...data import ( data_context, ) diff --git a/test/lib/ansible_test/_internal/commands/env/__init__.py b/test/lib/ansible_test/_internal/commands/env/__init__.py index 8b1b002ad84..ad13ab4f104 100644 --- a/test/lib/ansible_test/_internal/commands/env/__init__.py +++ b/test/lib/ansible_test/_internal/commands/env/__init__.py @@ -10,17 +10,17 @@ import signal import sys import time -from .config import ( +from ...config import ( CommonConfig, TestConfig, ) -from .io import ( +from ...io import ( write_json_file, read_json_file, ) -from .util import ( +from ...util import ( display, SubprocessError, ApplicationError, @@ -28,31 +28,31 @@ from .util import ( get_available_python_versions, ) -from .util_common import ( +from ...util_common import ( data_context, write_json_test_results, ResultType, ) -from .docker_util import ( +from ...docker_util import ( get_docker_command, docker_info, docker_version ) -from .thread import ( +from ...thread import ( WrappedThread, ) -from .constants import ( +from ...constants import ( TIMEOUT_PATH, ) -from .test import ( +from ...test import ( TestTimeout, ) -from .ci import ( +from ...ci import ( get_ci_provider, ) diff --git a/test/lib/ansible_test/_internal/commands/integration/__init__.py b/test/lib/ansible_test/_internal/commands/integration/__init__.py index f7be34e7d10..ec2d4523556 100644 --- a/test/lib/ansible_test/_internal/commands/integration/__init__.py +++ b/test/lib/ansible_test/_internal/commands/integration/__init__.py @@ -8,31 +8,31 @@ import os import shutil import tempfile -from .. import types as t +from ... import types as t -from ..encoding import ( +from ...encoding import ( to_bytes, ) -from ..target import ( +from ...target import ( analyze_integration_target_dependencies, walk_integration_targets, ) -from ..config import ( +from ...config import ( IntegrationConfig, NetworkIntegrationConfig, PosixIntegrationConfig, WindowsIntegrationConfig, ) -from ..io import ( +from ...io import ( make_dirs, write_text_file, read_text_file, ) -from ..util import ( +from ...util import ( ApplicationError, display, COVERAGE_CONFIG_NAME, @@ -41,24 +41,24 @@ from ..util import ( MODE_FILE, ) -from ..util_common import ( +from ...util_common import ( named_temporary_file, ResultType, ) -from ..coverage_util import ( +from ...coverage_util import ( generate_coverage_config, ) -from ..cache import ( +from ...cache import ( CommonCache, ) -from ..cloud import ( +from .cloud import ( CloudEnvironmentConfig, ) -from ..data import ( +from ...data import ( data_context, ) diff --git a/test/lib/ansible_test/_internal/commands/integration/cloud/__init__.py b/test/lib/ansible_test/_internal/commands/integration/cloud/__init__.py index 67309b19193..5c9c30de417 100644 --- a/test/lib/ansible_test/_internal/commands/integration/cloud/__init__.py +++ b/test/lib/ansible_test/_internal/commands/integration/cloud/__init__.py @@ -10,17 +10,17 @@ import re import tempfile import time -from .. import types as t +from .... import types as t -from ..encoding import ( +from ....encoding import ( to_bytes, ) -from ..io import ( +from ....io import ( read_text_file, ) -from ..util import ( +from ....util import ( ABC, ANSIBLE_TEST_CONFIG_ROOT, ApplicationError, @@ -29,29 +29,29 @@ from ..util import ( load_plugins, ) -from ..util_common import ( +from ....util_common import ( ResultType, write_json_test_results, ) -from ..target import ( +from ....target import ( IntegrationTarget, ) -from ..config import ( +from ....config import ( IntegrationConfig, TestConfig, ) -from ..ci import ( +from ....ci import ( get_ci_provider, ) -from ..data import ( +from ....data import ( data_context, ) -from ..docker_util import ( +from ....docker_util import ( get_docker_command, ) @@ -61,7 +61,7 @@ ENVIRONMENTS = {} def initialize_cloud_plugins(): # type: () -> None """Import cloud plugins and load them into the plugin dictionaries.""" - import_plugins('cloud') + import_plugins('commands/integration/cloud') load_plugins(CloudProvider, PROVIDERS) load_plugins(CloudEnvironment, ENVIRONMENTS) diff --git a/test/lib/ansible_test/_internal/commands/integration/cloud/acme.py b/test/lib/ansible_test/_internal/commands/integration/cloud/acme.py index 253f803c6f3..748d1350643 100644 --- a/test/lib/ansible_test/_internal/commands/integration/cloud/acme.py +++ b/test/lib/ansible_test/_internal/commands/integration/cloud/acme.py @@ -4,11 +4,11 @@ __metaclass__ = type import os -from ..config import ( +from ....config import ( IntegrationConfig, ) -from ..containers import ( +from ....containers import ( run_support_container, ) diff --git a/test/lib/ansible_test/_internal/commands/integration/cloud/aws.py b/test/lib/ansible_test/_internal/commands/integration/cloud/aws.py index 32c86ab6d0c..24816ea7722 100644 --- a/test/lib/ansible_test/_internal/commands/integration/cloud/aws.py +++ b/test/lib/ansible_test/_internal/commands/integration/cloud/aws.py @@ -4,23 +4,23 @@ __metaclass__ = type import os -from .. import types as t +from .... import types as t -from ..util import ( +from ....util import ( ApplicationError, ConfigParser, display, ) -from ..config import ( +from ....config import ( IntegrationConfig, ) -from ..target import ( +from ....target import ( IntegrationTarget, ) -from ..core_ci import ( +from ....core_ci import ( AnsibleCoreCI, ) diff --git a/test/lib/ansible_test/_internal/commands/integration/cloud/azure.py b/test/lib/ansible_test/_internal/commands/integration/cloud/azure.py index 246c98e4575..59d78c67537 100644 --- a/test/lib/ansible_test/_internal/commands/integration/cloud/azure.py +++ b/test/lib/ansible_test/_internal/commands/integration/cloud/azure.py @@ -4,34 +4,34 @@ __metaclass__ = type import os -from .. import types as t +from .... import types as t -from ..io import ( +from ....io import ( read_text_file, ) -from ..util import ( +from ....util import ( ApplicationError, ConfigParser, display, ) -from ..config import ( +from ....config import ( IntegrationConfig, ) -from ..target import ( +from ....target import ( IntegrationTarget, ) -from ..http import ( +from ....http import ( HttpClient, parse_qs, urlparse, urlunparse, ) -from ..core_ci import ( +from ....core_ci import ( AnsibleCoreCI, ) diff --git a/test/lib/ansible_test/_internal/commands/integration/cloud/cloudscale.py b/test/lib/ansible_test/_internal/commands/integration/cloud/cloudscale.py index 2cff1b6d667..095b030862f 100644 --- a/test/lib/ansible_test/_internal/commands/integration/cloud/cloudscale.py +++ b/test/lib/ansible_test/_internal/commands/integration/cloud/cloudscale.py @@ -7,12 +7,12 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -from ..util import ( +from ....util import ( ConfigParser, display, ) -from ..config import ( +from ....config import ( IntegrationConfig, ) diff --git a/test/lib/ansible_test/_internal/commands/integration/cloud/cs.py b/test/lib/ansible_test/_internal/commands/integration/cloud/cs.py index 8d6d74fd30e..9b58c46fc4b 100644 --- a/test/lib/ansible_test/_internal/commands/integration/cloud/cs.py +++ b/test/lib/ansible_test/_internal/commands/integration/cloud/cs.py @@ -5,27 +5,27 @@ __metaclass__ = type import json import os -from .. import types as t +from .... import types as t -from ..util import ( +from ....util import ( ApplicationError, ConfigParser, display, ) -from ..config import ( +from ....config import ( IntegrationConfig, ) -from ..http import ( +from ....http import ( urlparse, ) -from ..docker_util import ( +from ....docker_util import ( docker_exec, ) -from ..containers import ( +from ....containers import ( run_support_container, wait_for_file, ) diff --git a/test/lib/ansible_test/_internal/commands/integration/cloud/foreman.py b/test/lib/ansible_test/_internal/commands/integration/cloud/foreman.py index 82a12d50560..36db874161e 100644 --- a/test/lib/ansible_test/_internal/commands/integration/cloud/foreman.py +++ b/test/lib/ansible_test/_internal/commands/integration/cloud/foreman.py @@ -4,11 +4,11 @@ __metaclass__ = type import os -from ..config import ( +from ....config import ( IntegrationConfig, ) -from ..containers import ( +from ....containers import ( run_support_container, ) diff --git a/test/lib/ansible_test/_internal/commands/integration/cloud/galaxy.py b/test/lib/ansible_test/_internal/commands/integration/cloud/galaxy.py index 81c6891ddf9..d5bf37ccd4c 100644 --- a/test/lib/ansible_test/_internal/commands/integration/cloud/galaxy.py +++ b/test/lib/ansible_test/_internal/commands/integration/cloud/galaxy.py @@ -5,15 +5,15 @@ __metaclass__ = type import os import tempfile -from ..config import ( +from ....config import ( IntegrationConfig, ) -from ..docker_util import ( +from ....docker_util import ( docker_cp_to, ) -from ..containers import ( +from ....containers import ( run_support_container, ) diff --git a/test/lib/ansible_test/_internal/commands/integration/cloud/gcp.py b/test/lib/ansible_test/_internal/commands/integration/cloud/gcp.py index d4688f2f3b0..a7409a375e3 100644 --- a/test/lib/ansible_test/_internal/commands/integration/cloud/gcp.py +++ b/test/lib/ansible_test/_internal/commands/integration/cloud/gcp.py @@ -4,12 +4,12 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -from ..util import ( +from ....util import ( display, ConfigParser, ) -from ..config import ( +from ....config import ( IntegrationConfig, ) diff --git a/test/lib/ansible_test/_internal/commands/integration/cloud/hcloud.py b/test/lib/ansible_test/_internal/commands/integration/cloud/hcloud.py index 4966b29b9b1..a897d34c65b 100644 --- a/test/lib/ansible_test/_internal/commands/integration/cloud/hcloud.py +++ b/test/lib/ansible_test/_internal/commands/integration/cloud/hcloud.py @@ -2,22 +2,22 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -from .. import types as t +from .... import types as t -from ..util import ( +from ....util import ( ConfigParser, display, ) -from ..config import ( +from ....config import ( IntegrationConfig, ) -from ..target import ( +from ....target import ( IntegrationTarget, ) -from ..core_ci import ( +from ....core_ci import ( AnsibleCoreCI, ) diff --git a/test/lib/ansible_test/_internal/commands/integration/cloud/httptester.py b/test/lib/ansible_test/_internal/commands/integration/cloud/httptester.py index b1a2c8411b5..d26244656b0 100644 --- a/test/lib/ansible_test/_internal/commands/integration/cloud/httptester.py +++ b/test/lib/ansible_test/_internal/commands/integration/cloud/httptester.py @@ -4,16 +4,16 @@ __metaclass__ = type import os -from ..util import ( +from ....util import ( display, generate_password, ) -from ..config import ( +from ....config import ( IntegrationConfig, ) -from ..containers import ( +from ....containers import ( run_support_container, ) diff --git a/test/lib/ansible_test/_internal/commands/integration/cloud/nios.py b/test/lib/ansible_test/_internal/commands/integration/cloud/nios.py index e79a7a1689a..d75a55b167a 100644 --- a/test/lib/ansible_test/_internal/commands/integration/cloud/nios.py +++ b/test/lib/ansible_test/_internal/commands/integration/cloud/nios.py @@ -4,11 +4,11 @@ __metaclass__ = type import os -from ..config import ( +from ....config import ( IntegrationConfig, ) -from ..containers import ( +from ....containers import ( run_support_container, ) diff --git a/test/lib/ansible_test/_internal/commands/integration/cloud/opennebula.py b/test/lib/ansible_test/_internal/commands/integration/cloud/opennebula.py index 6aea34a7b98..029a5699141 100644 --- a/test/lib/ansible_test/_internal/commands/integration/cloud/opennebula.py +++ b/test/lib/ansible_test/_internal/commands/integration/cloud/opennebula.py @@ -2,7 +2,7 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -from ..util import ( +from ....util import ( ConfigParser, display, ) diff --git a/test/lib/ansible_test/_internal/commands/integration/cloud/openshift.py b/test/lib/ansible_test/_internal/commands/integration/cloud/openshift.py index 5fa62c4c025..0924aa4c7cb 100644 --- a/test/lib/ansible_test/_internal/commands/integration/cloud/openshift.py +++ b/test/lib/ansible_test/_internal/commands/integration/cloud/openshift.py @@ -4,19 +4,19 @@ __metaclass__ = type import re -from ..io import ( +from ....io import ( read_text_file, ) -from ..util import ( +from ....util import ( display, ) -from ..config import ( +from ....config import ( IntegrationConfig, ) -from ..containers import ( +from ....containers import ( run_support_container, wait_for_file, ) diff --git a/test/lib/ansible_test/_internal/commands/integration/cloud/scaleway.py b/test/lib/ansible_test/_internal/commands/integration/cloud/scaleway.py index 7ab3c4b5a31..af8e3dcbaf7 100644 --- a/test/lib/ansible_test/_internal/commands/integration/cloud/scaleway.py +++ b/test/lib/ansible_test/_internal/commands/integration/cloud/scaleway.py @@ -2,12 +2,12 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -from ..util import ( +from ....util import ( ConfigParser, display, ) -from ..config import ( +from ....config import ( IntegrationConfig, ) diff --git a/test/lib/ansible_test/_internal/commands/integration/cloud/vcenter.py b/test/lib/ansible_test/_internal/commands/integration/cloud/vcenter.py index 6e7552e9095..1ee191fd668 100644 --- a/test/lib/ansible_test/_internal/commands/integration/cloud/vcenter.py +++ b/test/lib/ansible_test/_internal/commands/integration/cloud/vcenter.py @@ -4,17 +4,17 @@ __metaclass__ = type import os -from ..util import ( +from ....util import ( ApplicationError, ConfigParser, display, ) -from ..config import ( +from ....config import ( IntegrationConfig, ) -from ..containers import ( +from ....containers import ( run_support_container, ) diff --git a/test/lib/ansible_test/_internal/commands/integration/cloud/vultr.py b/test/lib/ansible_test/_internal/commands/integration/cloud/vultr.py index ee9d8098096..9abc65cb6a6 100644 --- a/test/lib/ansible_test/_internal/commands/integration/cloud/vultr.py +++ b/test/lib/ansible_test/_internal/commands/integration/cloud/vultr.py @@ -2,12 +2,12 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -from ..util import ( +from ....util import ( ConfigParser, display, ) -from ..config import ( +from ....config import ( IntegrationConfig, ) diff --git a/test/lib/ansible_test/_internal/commands/sanity/__init__.py b/test/lib/ansible_test/_internal/commands/sanity/__init__.py index 0804b4198dc..1b7c468413e 100644 --- a/test/lib/ansible_test/_internal/commands/sanity/__init__.py +++ b/test/lib/ansible_test/_internal/commands/sanity/__init__.py @@ -8,13 +8,13 @@ import os import re import collections -from .. import types as t +from ... import types as t -from ..io import ( +from ...io import ( read_json_file, ) -from ..util import ( +from ...util import ( ApplicationError, SubprocessError, display, @@ -36,34 +36,34 @@ from ..util import ( REMOTE_ONLY_PYTHON_VERSIONS, ) -from ..util_common import ( +from ...util_common import ( run_command, intercept_command, handle_layout_messages, ) -from ..ansible_util import ( +from ...ansible_util import ( ansible_environment, ) -from ..target import ( +from ...target import ( walk_internal_targets, walk_sanity_targets, TestTarget, ) -from ..executor import ( +from ...executor import ( get_changes_filter, AllTargetsSkipped, Delegate, install_command_requirements, ) -from ..config import ( +from ...config import ( SanityConfig, ) -from ..test import ( +from ...test import ( TestSuccess, TestFailure, TestSkipped, @@ -71,11 +71,11 @@ from ..test import ( calculate_best_confidence, ) -from ..data import ( +from ...data import ( data_context, ) -from ..content_config import ( +from ...content_config import ( get_content_config, ) @@ -1047,7 +1047,7 @@ SANITY_TESTS = ( def sanity_init(): """Initialize full sanity test list (includes code-smell scripts determined at runtime).""" - import_plugins('sanity') + import_plugins('commands/sanity') sanity_plugins = {} # type: t.Dict[str, t.Type[SanityFunc]] load_plugins(SanityFunc, sanity_plugins) sanity_tests = tuple([plugin() for plugin in sanity_plugins.values() if data_context().content.is_ansible or not plugin.ansible_only]) diff --git a/test/lib/ansible_test/_internal/commands/sanity/ansible_doc.py b/test/lib/ansible_test/_internal/commands/sanity/ansible_doc.py index fc4c42f881b..491dc01473e 100644 --- a/test/lib/ansible_test/_internal/commands/sanity/ansible_doc.py +++ b/test/lib/ansible_test/_internal/commands/sanity/ansible_doc.py @@ -6,41 +6,41 @@ import collections import os import re -from .. import types as t +from ... import types as t -from ..sanity import ( +from . import ( SanitySingleVersion, SanityFailure, SanitySuccess, ) -from ..target import ( +from ...target import ( TestTarget, ) -from ..util import ( +from ...util import ( SubprocessError, display, is_subdir, ) -from ..util_common import ( +from ...util_common import ( intercept_command, ) -from ..ansible_util import ( +from ...ansible_util import ( ansible_environment, ) -from ..config import ( +from ...config import ( SanityConfig, ) -from ..data import ( +from ...data import ( data_context, ) -from ..coverage_util import ( +from ...coverage_util import ( coverage_context, ) diff --git a/test/lib/ansible_test/_internal/commands/sanity/bin_symlinks.py b/test/lib/ansible_test/_internal/commands/sanity/bin_symlinks.py index bd0ba58e802..185f22d1fa0 100644 --- a/test/lib/ansible_test/_internal/commands/sanity/bin_symlinks.py +++ b/test/lib/ansible_test/_internal/commands/sanity/bin_symlinks.py @@ -4,29 +4,29 @@ __metaclass__ = type import os -from .. import types as t +from ... import types as t -from ..sanity import ( +from . import ( SanityVersionNeutral, SanityMessage, SanityFailure, SanitySuccess, ) -from ..config import ( +from ...config import ( SanityConfig, ) -from ..data import ( +from ...data import ( data_context, ) -from ..payload import ( +from ...payload import ( ANSIBLE_BIN_SYMLINK_MAP, __file__ as symlink_map_full_path, ) -from ..util import ( +from ...util import ( ANSIBLE_BIN_PATH, ANSIBLE_TEST_DATA_ROOT, ) diff --git a/test/lib/ansible_test/_internal/commands/sanity/compile.py b/test/lib/ansible_test/_internal/commands/sanity/compile.py index 5a517272fa0..3577c60a333 100644 --- a/test/lib/ansible_test/_internal/commands/sanity/compile.py +++ b/test/lib/ansible_test/_internal/commands/sanity/compile.py @@ -4,9 +4,9 @@ __metaclass__ = type import os -from .. import types as t +from ... import types as t -from ..sanity import ( +from . import ( SanityMultipleVersion, SanityMessage, SanityFailure, @@ -15,11 +15,11 @@ from ..sanity import ( SANITY_ROOT, ) -from ..target import ( +from ...target import ( TestTarget, ) -from ..util import ( +from ...util import ( SubprocessError, display, find_python, @@ -27,11 +27,11 @@ from ..util import ( is_subdir, ) -from ..util_common import ( +from ...util_common import ( run_command, ) -from ..config import ( +from ...config import ( SanityConfig, ) diff --git a/test/lib/ansible_test/_internal/commands/sanity/ignores.py b/test/lib/ansible_test/_internal/commands/sanity/ignores.py index 8b6df50ce41..97447719b2e 100644 --- a/test/lib/ansible_test/_internal/commands/sanity/ignores.py +++ b/test/lib/ansible_test/_internal/commands/sanity/ignores.py @@ -4,7 +4,7 @@ __metaclass__ = type import os -from ..sanity import ( +from . import ( SanityFailure, SanityIgnoreParser, SanityVersionNeutral, @@ -12,12 +12,12 @@ from ..sanity import ( SanityMessage, ) -from ..test import ( +from ...test import ( calculate_confidence, calculate_best_confidence, ) -from ..config import ( +from ...config import ( SanityConfig, ) diff --git a/test/lib/ansible_test/_internal/commands/sanity/import.py b/test/lib/ansible_test/_internal/commands/sanity/import.py index 0f56851615e..d3a884555c2 100644 --- a/test/lib/ansible_test/_internal/commands/sanity/import.py +++ b/test/lib/ansible_test/_internal/commands/sanity/import.py @@ -4,9 +4,9 @@ __metaclass__ = type import os -from .. import types as t +from ... import types as t -from ..sanity import ( +from . import ( SanityMultipleVersion, SanityMessage, SanityFailure, @@ -15,11 +15,11 @@ from ..sanity import ( SANITY_ROOT, ) -from ..target import ( +from ...target import ( TestTarget, ) -from ..util import ( +from ...util import ( ANSIBLE_TEST_DATA_ROOT, SubprocessError, remove_tree, @@ -32,34 +32,34 @@ from ..util import ( REMOTE_ONLY_PYTHON_VERSIONS, ) -from ..util_common import ( +from ...util_common import ( intercept_command, run_command, ResultType, ) -from ..ansible_util import ( +from ...ansible_util import ( ansible_environment, ) -from ..executor import ( +from ...executor import ( generate_pip_install, install_cryptography, ) -from ..config import ( +from ...config import ( SanityConfig, ) -from ..coverage_util import ( +from ...coverage_util import ( coverage_context, ) -from ..venv import ( +from ...venv import ( create_virtual_environment, ) -from ..data import ( +from ...data import ( data_context, ) diff --git a/test/lib/ansible_test/_internal/commands/sanity/integration_aliases.py b/test/lib/ansible_test/_internal/commands/sanity/integration_aliases.py index 4bfd5ef8a6c..13db83df7ca 100644 --- a/test/lib/ansible_test/_internal/commands/sanity/integration_aliases.py +++ b/test/lib/ansible_test/_internal/commands/sanity/integration_aliases.py @@ -6,9 +6,9 @@ import json import textwrap import os -from .. import types as t +from ... import types as t -from ..sanity import ( +from . import ( SanityVersionNeutral, SanityMessage, SanityFailure, @@ -17,11 +17,11 @@ from ..sanity import ( SANITY_ROOT, ) -from ..config import ( +from ...config import ( SanityConfig, ) -from ..target import ( +from ...target import ( filter_targets, walk_posix_integration_targets, walk_windows_integration_targets, @@ -29,21 +29,21 @@ from ..target import ( walk_module_targets, ) -from ..cloud import ( +from ..integration.cloud import ( get_cloud_platforms, ) -from ..io import ( +from ...io import ( read_text_file, ) -from ..util import ( +from ...util import ( display, find_python, raw_command, ) -from ..util_common import ( +from ...util_common import ( write_json_test_results, ResultType, ) diff --git a/test/lib/ansible_test/_internal/commands/sanity/pep8.py b/test/lib/ansible_test/_internal/commands/sanity/pep8.py index 9eb40dbce7d..b1244c68721 100644 --- a/test/lib/ansible_test/_internal/commands/sanity/pep8.py +++ b/test/lib/ansible_test/_internal/commands/sanity/pep8.py @@ -4,9 +4,9 @@ __metaclass__ = type import os -from .. import types as t +from ... import types as t -from ..sanity import ( +from . import ( SanitySingleVersion, SanityMessage, SanityFailure, @@ -14,11 +14,11 @@ from ..sanity import ( SANITY_ROOT, ) -from ..target import ( +from ...target import ( TestTarget, ) -from ..util import ( +from ...util import ( SubprocessError, read_lines_without_comments, parse_to_list_of_dict, @@ -26,11 +26,11 @@ from ..util import ( is_subdir, ) -from ..util_common import ( +from ...util_common import ( run_command, ) -from ..config import ( +from ...config import ( SanityConfig, ) diff --git a/test/lib/ansible_test/_internal/commands/sanity/pslint.py b/test/lib/ansible_test/_internal/commands/sanity/pslint.py index 256eee0464d..1a6b5eb377f 100644 --- a/test/lib/ansible_test/_internal/commands/sanity/pslint.py +++ b/test/lib/ansible_test/_internal/commands/sanity/pslint.py @@ -6,9 +6,9 @@ import json import os import re -from .. import types as t +from ... import types as t -from ..sanity import ( +from . import ( SanityVersionNeutral, SanityMessage, SanityFailure, @@ -17,25 +17,25 @@ from ..sanity import ( SANITY_ROOT, ) -from ..target import ( +from ...target import ( TestTarget, ) -from ..util import ( +from ...util import ( SubprocessError, find_executable, ANSIBLE_TEST_DATA_ROOT, ) -from ..util_common import ( +from ...util_common import ( run_command, ) -from ..config import ( +from ...config import ( SanityConfig, ) -from ..data import ( +from ...data import ( data_context, ) diff --git a/test/lib/ansible_test/_internal/commands/sanity/pylint.py b/test/lib/ansible_test/_internal/commands/sanity/pylint.py index dedb17c9172..64983a4d499 100644 --- a/test/lib/ansible_test/_internal/commands/sanity/pylint.py +++ b/test/lib/ansible_test/_internal/commands/sanity/pylint.py @@ -7,9 +7,9 @@ import json import os import datetime -from .. import types as t +from ... import types as t -from ..sanity import ( +from . import ( SanitySingleVersion, SanityMessage, SanityFailure, @@ -17,11 +17,11 @@ from ..sanity import ( SANITY_ROOT, ) -from ..target import ( +from ...target import ( TestTarget, ) -from ..util import ( +from ...util import ( SubprocessError, display, ConfigParser, @@ -29,22 +29,22 @@ from ..util import ( find_python, ) -from ..util_common import ( +from ...util_common import ( run_command, ) -from ..ansible_util import ( +from ...ansible_util import ( ansible_environment, get_collection_detail, CollectionDetail, CollectionDetailError, ) -from ..config import ( +from ...config import ( SanityConfig, ) -from ..data import ( +from ...data import ( data_context, ) diff --git a/test/lib/ansible_test/_internal/commands/sanity/sanity_docs.py b/test/lib/ansible_test/_internal/commands/sanity/sanity_docs.py index 44638075ee2..5ebdae84d67 100644 --- a/test/lib/ansible_test/_internal/commands/sanity/sanity_docs.py +++ b/test/lib/ansible_test/_internal/commands/sanity/sanity_docs.py @@ -4,7 +4,7 @@ __metaclass__ = type import os -from ..sanity import ( +from . import ( SanityVersionNeutral, SanityMessage, SanityFailure, @@ -12,11 +12,11 @@ from ..sanity import ( sanity_get_tests, ) -from ..config import ( +from ...config import ( SanityConfig, ) -from ..data import ( +from ...data import ( data_context, ) diff --git a/test/lib/ansible_test/_internal/commands/sanity/shellcheck.py b/test/lib/ansible_test/_internal/commands/sanity/shellcheck.py index 82689ced1e1..66f7b643bfc 100644 --- a/test/lib/ansible_test/_internal/commands/sanity/shellcheck.py +++ b/test/lib/ansible_test/_internal/commands/sanity/shellcheck.py @@ -9,9 +9,9 @@ from xml.etree.ElementTree import ( Element, ) -from .. import types as t +from ... import types as t -from ..sanity import ( +from . import ( SanityVersionNeutral, SanityMessage, SanityFailure, @@ -20,21 +20,21 @@ from ..sanity import ( SANITY_ROOT, ) -from ..target import ( +from ...target import ( TestTarget, ) -from ..util import ( +from ...util import ( SubprocessError, read_lines_without_comments, find_executable, ) -from ..util_common import ( +from ...util_common import ( run_command, ) -from ..config import ( +from ...config import ( SanityConfig, ) diff --git a/test/lib/ansible_test/_internal/commands/sanity/validate_modules.py b/test/lib/ansible_test/_internal/commands/sanity/validate_modules.py index add3cdc7ce3..e191f1658a9 100644 --- a/test/lib/ansible_test/_internal/commands/sanity/validate_modules.py +++ b/test/lib/ansible_test/_internal/commands/sanity/validate_modules.py @@ -5,9 +5,9 @@ __metaclass__ = type import json import os -from .. import types as t +from ... import types as t -from ..sanity import ( +from . import ( SanitySingleVersion, SanityMessage, SanityFailure, @@ -15,35 +15,35 @@ from ..sanity import ( SANITY_ROOT, ) -from ..target import ( +from ...target import ( TestTarget, ) -from ..util import ( +from ...util import ( SubprocessError, display, find_python, ) -from ..util_common import ( +from ...util_common import ( run_command, ) -from ..ansible_util import ( +from ...ansible_util import ( ansible_environment, get_collection_detail, CollectionDetailError, ) -from ..config import ( +from ...config import ( SanityConfig, ) -from ..ci import ( +from ...ci import ( get_ci_provider, ) -from ..data import ( +from ...data import ( data_context, ) diff --git a/test/lib/ansible_test/_internal/commands/sanity/yamllint.py b/test/lib/ansible_test/_internal/commands/sanity/yamllint.py index 85a576d02d2..42a69acedf7 100644 --- a/test/lib/ansible_test/_internal/commands/sanity/yamllint.py +++ b/test/lib/ansible_test/_internal/commands/sanity/yamllint.py @@ -5,11 +5,13 @@ __metaclass__ = type import json import os -from .. import types as t +from ... import types as t -from ..import ansible_util +from ...ansible_util import ( + check_pyyaml, +) -from ..sanity import ( +from . import ( SanitySingleVersion, SanityMessage, SanityFailure, @@ -18,26 +20,26 @@ from ..sanity import ( SANITY_ROOT, ) -from ..target import ( +from ...target import ( TestTarget, ) -from ..util import ( +from ...util import ( SubprocessError, display, is_subdir, find_python, ) -from ..util_common import ( +from ...util_common import ( run_command, ) -from ..config import ( +from ...config import ( SanityConfig, ) -from ..data import ( +from ...data import ( data_context, ) @@ -71,7 +73,7 @@ class YamllintTest(SanitySingleVersion): :type python_version: str :rtype: TestResult """ - pyyaml_presence = ansible_util.check_pyyaml(args, python_version, quiet=True) + pyyaml_presence = check_pyyaml(args, python_version, quiet=True) if not pyyaml_presence['cloader']: display.warning("Skipping sanity test '%s' due to missing libyaml support in PyYAML." % self.name) diff --git a/test/lib/ansible_test/_internal/commands/units/__init__.py b/test/lib/ansible_test/_internal/commands/units/__init__.py index 870a6f97a60..51aa804fa0c 100644 --- a/test/lib/ansible_test/_internal/commands/units/__init__.py +++ b/test/lib/ansible_test/_internal/commands/units/__init__.py @@ -5,12 +5,12 @@ __metaclass__ = type import os import sys -from ..io import ( +from ...io import ( write_text_file, make_dirs, ) -from ..util import ( +from ...util import ( ANSIBLE_TEST_DATA_ROOT, display, get_available_python_versions, @@ -23,44 +23,44 @@ from ..util import ( ANSIBLE_LIB_ROOT, ) -from ..util_common import ( +from ...util_common import ( intercept_command, ResultType, handle_layout_messages, create_temp_dir, ) -from ..ansible_util import ( +from ...ansible_util import ( ansible_environment, check_pyyaml, get_ansible_python_path, ) -from ..target import ( +from ...target import ( walk_internal_targets, walk_units_targets, ) -from ..config import ( +from ...config import ( UnitsConfig, ) -from ..coverage_util import ( +from ...coverage_util import ( coverage_context, ) -from ..data import ( +from ...data import ( data_context, ) -from ..executor import ( +from ...executor import ( AllTargetsSkipped, Delegate, get_changes_filter, install_command_requirements, ) -from ..content_config import ( +from ...content_config import ( get_content_config, ) diff --git a/test/lib/ansible_test/_internal/executor.py b/test/lib/ansible_test/_internal/executor.py index bb4cca2dd8a..f2af5974d2b 100644 --- a/test/lib/ansible_test/_internal/executor.py +++ b/test/lib/ansible_test/_internal/executor.py @@ -33,7 +33,7 @@ from .manage_ci import ( get_network_settings, ) -from .cloud import ( +from .commands.integration.cloud import ( cloud_filter, cloud_init, get_cloud_environment, @@ -133,7 +133,7 @@ from .metadata import ( ChangeDescription, ) -from .integration import ( +from .commands.integration import ( integration_test_environment, integration_test_config_file, setup_common_temp_dir,