mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 03:11:24 -07:00
[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:
parent
7ba3d84004
commit
57dcd31c82
94 changed files with 217 additions and 267 deletions
|
@ -69,7 +69,7 @@ class UTHelper(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
|
||||
"""
|
||||
|
@ -79,8 +79,8 @@ class UTHelper(object):
|
|||
args["_ansible_check_mode"] = test_case.flags.get("check")
|
||||
if test_case.flags.get("diff"):
|
||||
args["_ansible_diff"] = test_case.flags.get("diff")
|
||||
patch_ansible_module(args)
|
||||
self.runner.run(mocker, capfd, test_case)
|
||||
with patch_ansible_module_uthelper(args):
|
||||
self.runner.run(mocker, capfd, test_case)
|
||||
|
||||
self.add_func_to_test_module("test_module", _test_module)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue