From 9127a428342164823328e7522a3a841eafe68e03 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Mon, 26 Jul 2021 14:46:22 +0100 Subject: [PATCH] Assures we use venv with ansible-test (#93) This fixed bug where ansible-test executions were hard to reproduce across different machines and where user installed packages may influence the outcome. --- src/tox_ansible/ansible/__init__.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/tox_ansible/ansible/__init__.py b/src/tox_ansible/ansible/__init__.py index 4e51bee..9d3f075 100644 --- a/src/tox_ansible/ansible/__init__.py +++ b/src/tox_ansible/ansible/__init__.py @@ -128,25 +128,29 @@ def tox_cases(self): # pylint: disable=fixme # TODO(ssbarnea): Detect and enable only those tests that do exist # to avoid confusing tox user. + # + # We use --venv because otherwise we risk getting errors from the + # system environment, especially as one of tests performed is + # 'pip check'. ANSIBLE_TEST_COMMANDS: Dict[str, Dict[str, Any]] = { "integration": { - "args": ["--requirements"], + "args": ["--requirements", "--venv"], "requires": "tests/integration", }, "network-integration": { - "args": ["--requirements"], + "args": ["--requirements", "--venv"], "requires": "tests/network-integration", }, # sanity tests do not need presence of sanity check or even tests # folder - "sanity": {"args": ["--requirements"], "requires": ""}, - "shell": {"args": ["--requirements"]}, + "sanity": {"args": ["--requirements", "--venv"], "requires": ""}, + "shell": {"args": ["--requirements", "--venv"]}, "units": { - "args": ["--requirements"], + "args": ["--requirements", "--venv"], "requires": "tests/unit", }, "windows-integration": { - "args": ["--requirements"], + "args": ["--requirements", "--venv"], "requires": "tests/windows-integration", }, # special commands (not supported by us yet)