Molecule base config not considered when collecting tests
M4rt1nCh opened this issue · 0 comments
M4rt1nCh commented
Hi all,
Environment Details:
ansible 9.0.1
ansible-compat 4.1.10
ansible-core 2.16.0
ansible-lint 6.22.1
ansible-lint-junit 0.17.8
ansible-rulebook 1.0.4
ansible-runner 2.3.4
molecule 6.0.3
molecule-plugins 23.5.0
pytest 7.4.4
pytest-aiohttp 1.0.5
pytest-ansible 24.1.0
pytest-asyncio 0.23.3
pytest-html 4.1.1
pytest-json 0.4.0
pytest-lazy-fixture 0.6.3
pytest-metadata 3.0.0
pytest-mock 3.12.0
pytest-xdist 3.5.0
We rely on a base config for molecule that is located in <COLLECTION_DIR>/.config/molecule/config.yml
. When pytest runs the test discovery the base config file is not considered / processed. As a consequence, markers such as the marker for the driver is not applied unless it is maintained in each scenario's molecule.yml
file.
cd <COLLECTION_DIR>
pytest --collect-only --molecule tests/integration/molecule/
INFO:pytest_ansible.units:Looking for collection info in /home/$USER/.ansible/collections/ansible_collections/NAMESPACE/COLLECTIONNAME/galaxy.yml
INFO:pytest_ansible.units:Collection namespace: NAMESPACE
INFO:pytest_ansible.units:Collection name: COLLECTIONNAME
INFO:pytest_ansible.units:In collection tree
INFO:pytest_ansible.units:Additional Collections Paths: [PosixPath('/home/$USER/.ansible/collections')]
INFO:pytest_ansible.units:Setting ANSIBLE_COLLECTIONS_PATH to /home/$USER/.ansible/collections:/home/$USER/.ansible/collections
=========================================================================================================================================== test session starts ===========================================================================================================================================
platform linux -- Python 3.11.7, pytest-7.4.4, pluggy-1.3.0 -- /path/to/python/bin/python3.11
cachedir: .pytest_cache
metadata: {'Python': '3.11.7', 'Platform': 'Linux-6.5.0-1009-oem-x86_64-with-glibc2.35', 'Packages': {'pytest': '7.4.4', 'pluggy': '1.3.0'}, 'Plugins': {'asyncio': '0.23.3', 'metadata': '3.0.0', 'html': '4.1.1', 'lazy-fixture': '0.6.3', 'anyio': '4.2.0', 'mock': '3.12.0', 'xdist': '3.5.0', 'json': '0.4.0', 'ansible': '24.1.0', 'aiohttp': '1.0.5'}, 'GIT_BRANCH': 'feature-153-xyz'}
ansible: 2.16.0
rootdir: /home/$USER/.ansible/collections/ansible_collections/NAMESPACE/COLLECTIONNAME
configfile: pyproject.toml
plugins: asyncio-0.23.3, metadata-3.0.0, html-4.1.1, lazy-fixture-0.6.3, anyio-4.2.0, mock-3.12.0, xdist-3.5.0, json-0.4.0, ansible-24.1.0, aiohttp-1.0.5
asyncio: mode=Mode.STRICT
collected 36 items
tests/integration/molecule/scenario1/molecule.yml
test0[no_driver]
tests/integration/molecule/scenario2/molecule.yml
test1[no_driver]
tests/integration/molecule/scenario3/molecule.yml
test2[no_driver]
...