Skip to content

Commit

Permalink
ansible-test - Fix import sanity test for targets (ansible#81184)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattclay authored Jul 7, 2023
1 parent ca3ffbf commit 3d2ff64
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/ansible-test-import-sanity-fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- ansible-test - The ``import`` sanity test now checks the collection loader for remote-only Python support when testing ansible-core.
10 changes: 8 additions & 2 deletions test/lib/ansible_test/_internal/commands/sanity/import.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,20 @@ def test(self, args: SanityConfig, targets: SanityTargets, python: PythonConfig)
('plugin', _get_module_test(False)),
):
if import_type == 'plugin' and python.version in REMOTE_ONLY_PYTHON_VERSIONS:
continue
# Plugins are not supported on remote-only Python versions.
# However, the collection loader is used by the import sanity test and unit tests on remote-only Python versions.
# To support this, it is tested as a plugin, but using a venv which installs no requirements.
# Filtering of paths relevant to the Python version tested has already been performed by filter_remote_targets.
venv_type = 'empty'
else:
venv_type = import_type

data = '\n'.join([path for path in paths if test(path)])

if not data and not args.prime_venvs:
continue

virtualenv_python = create_sanity_virtualenv(args, python, f'{self.name}.{import_type}', coverage=args.coverage, minimize=True)
virtualenv_python = create_sanity_virtualenv(args, python, f'{self.name}.{venv_type}', coverage=args.coverage, minimize=True)

if not virtualenv_python:
display.warning(f'Skipping sanity test "{self.name}" on Python {python.version} due to missing virtual environment support.')
Expand Down

0 comments on commit 3d2ff64

Please sign in to comment.