ansible-test - Fix import sanity test for targets (#81184)

pull/81207/head
Matt Clay 1 year ago committed by GitHub
parent ca3ffbf4c2
commit 3d2ff64264
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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.

@ -127,14 +127,20 @@ class ImportTest(SanityMultipleVersion):
('plugin', _get_module_test(False)), ('plugin', _get_module_test(False)),
): ):
if import_type == 'plugin' and python.version in REMOTE_ONLY_PYTHON_VERSIONS: 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)]) data = '\n'.join([path for path in paths if test(path)])
if not data and not args.prime_venvs: if not data and not args.prime_venvs:
continue 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: if not virtualenv_python:
display.warning(f'Skipping sanity test "{self.name}" on Python {python.version} due to missing virtual environment support.') display.warning(f'Skipping sanity test "{self.name}" on Python {python.version} due to missing virtual environment support.')

Loading…
Cancel
Save