1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-26 13:42:49 +00:00

[stable-9] Use more unit test utils from community.internal_test_tools (#9920)

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)
This commit is contained in:
Felix Fontein 2025-03-22 14:12:44 +01:00 committed by GitHub
parent 3727bf7cd4
commit 928cdaaf87
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
89 changed files with 205 additions and 262 deletions

View file

@ -55,12 +55,12 @@ class Helper(object):
def set_test_func(self):
@pytest.mark.parametrize('test_case', self.test_cases, ids=[tc.id for tc in self.test_cases])
@pytest.mark.usefixtures(*self.fixtures)
def _test_module(mocker, capfd, patch_ansible_module, test_case):
def _test_module(mocker, capfd, patch_ansible_module_uthelper, test_case):
"""
Run unit tests for each test case in self.test_cases
"""
patch_ansible_module(test_case.input)
self.runner.run(mocker, capfd, test_case)
with patch_ansible_module_uthelper(test_case.input):
self.runner.run(mocker, capfd, test_case)
self.add_func_to_test_module("test_module", _test_module)