Summary
When using tox-ansible version 26.3.0 for integration tests on a collection which follows the User Guide - Testing Molecule Scenarios method.
In the tox-ansible integration-* environments install_deps phase the molecule and molecule-plugins packages are not installed causing pytest-ansible to fail:
uv run tox --ansible --conf tox-ansible.ini -e integration-py3.14-2.20
integration-py3.14-2.20: install_deps> .venv/bin/uv pip install 'ansible-compat>=25.11.0' 'ansible-dev-environment>=26.2.0' 'pytest-ansible>=v4.1.1' 'pytest-xdist>=3.4.0' 'pytest>=7.4.3'
integration-py3.14-2.20: commands[0]> python3 -m pytest --ansible-unit-inject-only ./tests/integration
=================================================================================================================================== test session starts ===================================================================================================================================
platform linux -- Python 3.14.3, pytest-9.0.3, pluggy-1.6.0
cachedir: .tox/integration-py3.14-2.20/.pytest_cache
ansible: 2.20.4
configfile: pyproject.toml
plugins: ansible-26.4.0, xdist-3.8.0, anyio-4.13.0
collected 0 items / 1 error
========================================================================================================================================= ERRORS ==========================================================================================================================================
_________________________________________________________________________________________________________________ ERROR collecting tests/integration/test_integration.py __________________________________________________________________________________________________________________
.tox/integration-py3.14-2.20/lib64/python3.14/site-packages/pluggy/_hooks.py:512: in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/integration-py3.14-2.20/lib64/python3.14/site-packages/pluggy/_manager.py:120: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/integration-py3.14-2.20/lib64/python3.14/site-packages/_pytest/python.py:249: in pytest_pycollect_makeitem
return list(collector._genfunctions(name, obj))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/integration-py3.14-2.20/lib64/python3.14/site-packages/_pytest/python.py:475: in _genfunctions
self.ihook.pytest_generate_tests.call_extra(methods, dict(metafunc=metafunc))
.tox/integration-py3.14-2.20/lib64/python3.14/site-packages/pluggy/_hooks.py:573: in call_extra
return self._hookexec(self.name, hookimpls, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/integration-py3.14-2.20/lib64/python3.14/site-packages/pluggy/_manager.py:120: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.tox/integration-py3.14-2.20/lib64/python3.14/site-packages/pytest_ansible/plugin.py:407: in pytest_generate_tests
pytest.exit("molecule not installed or found.")
E _pytest.outcomes.Exit: molecule not installed or found.
================================================================================================================================= short test summary info =================================================================================================================================
ERROR tests/integration/test_integration.py - _pytest.outcomes.Exit: molecule not installed or found.
Current workaround:
[testenv]
commands_pre =
integration: uv pip install 'molecule' 'molecule-plugins[docker]'
molecule-plugins being installed I guess is up for discussion, but IMHO at a minimum if we want to pattern to work we need molecule installed.
Summary
When using
tox-ansibleversion26.3.0for integration tests on a collection which follows the User Guide - Testing Molecule Scenarios method.In the
tox-ansibleintegration-*environmentsinstall_depsphase themoleculeandmolecule-pluginspackages are not installed causingpytest-ansibleto fail:Current workaround:
molecule-pluginsbeing installed I guess is up for discussion, but IMHO at a minimum if we want to pattern to work we needmoleculeinstalled.