Imports from ansible_collections
don't work in conftest
modules.
#62113
Labels
affects_2.10
This issue/PR affects Ansible v2.10
bug
This issue/PR relates to a bug.
support:core
This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
SUMMARY
(converted from project card created by @webknjaz)
When conftest in unit test contains something like
from ansible_collections.yum_unit_test_migration_spec.yum_collection.tests.unit.compat.mock import patch
, it will result inE ModuleNotFoundError: No module named 'ansible_collections'
.The workaround is to add a boilerplate
conftest.py
into tests root: webknjaz/fqcn_conftest_repro@b07826cCOMPONENT NAME
ansible-test
ANSIBLE VERSION
devel
CONFIGURATION
N/A
OS / ENVIRONMENT
N/A
STEPS TO REPRODUCE
Repro: https://github.com/webknjaz/fqcn_conftest_repro/tree/77347551f5fdd5185b26c752074878ea37055b77
Failure demo: https://github.com/webknjaz/fqcn_conftest_repro/runs/216648897#step:5:41
Hack demo: https://github.com/webknjaz/fqcn_conftest_repro/runs/216654164#step:5:65
EXPECTED RESULTS
Tests pass.
ACTUAL RESULTS
Tests fail.
The text was updated successfully, but these errors were encountered: