mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-04 23:39:09 -07:00
[PR #7192/14bc13ba backport][stable-7] further improvements (#7195)
further improvements (#7192)
* further improvements
* some renaming
(cherry picked from commit 14bc13ba3c
)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
2df1126d27
commit
cad6b30036
5 changed files with 31 additions and 51 deletions
|
@ -6,16 +6,15 @@
|
|||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import json
|
||||
from ansible_collections.community.general.plugins.modules import opkg as module
|
||||
|
||||
import pytest
|
||||
|
||||
from ansible_collections.community.general.plugins.modules import opkg as module
|
||||
from .cmd_runner_test_utils import CmdRunnerTestHelper
|
||||
|
||||
|
||||
with open("tests/unit/plugins/modules/test_opkg.yaml", "r") as TEST_CASES:
|
||||
helper = CmdRunnerTestHelper(test_cases=TEST_CASES)
|
||||
helper = CmdRunnerTestHelper(module.main, test_cases=TEST_CASES)
|
||||
patch_bin = helper.cmd_fixture
|
||||
|
||||
|
||||
|
@ -28,12 +27,5 @@ def test_module(mocker, capfd, patch_bin, testcase):
|
|||
Run unit tests for test cases listed in TEST_CASES
|
||||
"""
|
||||
|
||||
with helper(testcase, mocker) as ctx:
|
||||
# Try to run test case
|
||||
with pytest.raises(SystemExit):
|
||||
module.main()
|
||||
|
||||
out, err = capfd.readouterr()
|
||||
results = json.loads(out)
|
||||
|
||||
ctx.check_results(results)
|
||||
with helper(testcase, mocker, capfd) as testcase_context:
|
||||
testcase_context.run()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue