[PR #9918/8ab8010b backport][stable-10] Use more unit test utils from community.internal_test_tools (#9919)

Use more unit test utils from community.internal_test_tools (#9918)

* Make conftest's patch_ansible_module use the context manager from .utils.

* Fix test dependencies.

* Use module mock utils from community.internal_test_tools.

* Use DataDictLoader from community.internal_test_tools.

* Use trust util from community.internal_test_tools.

(cherry picked from commit 8ab8010b6d)

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
patchback[bot]
2025-03-22 13:52:39 +01:00
committed by GitHub
parent 7ba3d84004
commit 57dcd31c82
94 changed files with 217 additions and 267 deletions

View File

@@ -13,6 +13,7 @@ import yaml
from ansible.inventory.data import InventoryData
from ansible.template import Templar
from ansible_collections.community.general.plugins.inventory.iocage import InventoryModule
from ansible_collections.community.internal_test_tools.tests.unit.utils.trust import make_trusted
@pytest.fixture
@@ -49,7 +50,7 @@ def load_yml_data(path):
def get_option(option):
groups = {}
groups['test'] = "inventory_hostname.startswith('test')"
groups['test'] = make_trusted("inventory_hostname.startswith('test')")
if option == 'groups':
return groups

View File

@@ -19,9 +19,9 @@ from ansible import constants as C
from ansible.inventory.data import InventoryData
from ansible.inventory.manager import InventoryManager
from ansible.module_utils.common.text.converters import to_native
from ansible_collections.community.internal_test_tools.tests.unit.mock.loader import DictDataLoader
from ansible_collections.community.general.plugins.inventory.opennebula import InventoryModule
from ansible_collections.community.general.tests.unit.mock.loader import DictDataLoader
from ansible_collections.community.general.tests.unit.mock.path import mock_unfrackpath_noop