diff options
Diffstat (limited to 'tests/unit/modules/conftest.py')
-rw-r--r-- | tests/unit/modules/conftest.py | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/tests/unit/modules/conftest.py b/tests/unit/modules/conftest.py index e19a1e0..013d198 100644 --- a/tests/unit/modules/conftest.py +++ b/tests/unit/modules/conftest.py @@ -7,10 +7,9 @@ __metaclass__ = type import json import pytest - -from ansible.module_utils.six import string_types from ansible.module_utils._text import to_bytes from ansible.module_utils.common._collections_compat import MutableMapping +from ansible.module_utils.six import string_types @pytest.fixture @@ -21,20 +20,11 @@ def patch_ansible_module(request, mocker): if "ANSIBLE_MODULE_ARGS" not in request.param: request.param = {"ANSIBLE_MODULE_ARGS": request.param} if "_ansible_remote_tmp" not in request.param["ANSIBLE_MODULE_ARGS"]: - request.param["ANSIBLE_MODULE_ARGS"][ - "_ansible_remote_tmp" - ] = "/tmp" - if ( - "_ansible_keep_remote_files" - not in request.param["ANSIBLE_MODULE_ARGS"] - ): - request.param["ANSIBLE_MODULE_ARGS"][ - "_ansible_keep_remote_files" - ] = False + request.param["ANSIBLE_MODULE_ARGS"]["_ansible_remote_tmp"] = "/tmp" + if "_ansible_keep_remote_files" not in request.param["ANSIBLE_MODULE_ARGS"]: + request.param["ANSIBLE_MODULE_ARGS"]["_ansible_keep_remote_files"] = False args = json.dumps(request.param) else: - raise Exception( - "Malformed data to the patch_ansible_module pytest fixture" - ) + raise Exception("Malformed data to the patch_ansible_module pytest fixture") mocker.patch("ansible.module_utils.basic._ANSIBLE_ARGS", to_bytes(args)) |