Fix ansible-test coverage of ansible-connection.

This commit is contained in:
Matt Clay 2020-01-28 19:31:08 -08:00
parent 21069c84d9
commit 3c3cf50e7a
2 changed files with 11 additions and 0 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- ansible-test once again properly collects code coverage for ``ansible-connection``

View file

@ -27,6 +27,7 @@ from .util_common import (
)
from .config import (
IntegrationConfig,
PosixIntegrationConfig,
EnvironmentConfig,
CommonConfig,
@ -75,6 +76,14 @@ def ansible_environment(args, color=True, ansible_config=None):
PATH=path,
)
if isinstance(args, IntegrationConfig) and args.coverage:
# standard path injection is not effective for ansible-connection, instead the location must be configured
# ansible-connection only requires the injector for code coverage
# the correct python interpreter is already selected using the sys.executable used to invoke ansible
ansible.update(dict(
ANSIBLE_CONNECTION_PATH=os.path.join(ANSIBLE_TEST_DATA_ROOT, 'injector', 'ansible-connection'),
))
if isinstance(args, PosixIntegrationConfig):
ansible.update(dict(
ANSIBLE_PYTHON_INTERPRETER='/set/ansible_python_interpreter/in/inventory', # force tests to set ansible_python_interpreter in inventory