diff options
| author | Kate Case <kcase@redhat.com> | 2023-02-27 23:49:54 -0500 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-27 23:49:54 -0500 | 
| commit | 4d9f13491531e968b4b30b32577eccb324cf23dd (patch) | |
| tree | 003b0a38f43c712e23e9d71c0883ab2c4a73e00d | |
| parent | 5dc5a62c8479222b9fd3c09cd482177f863fa837 (diff) | |
| download | vyos.vyos-4d9f13491531e968b4b30b32577eccb324cf23dd.tar.gz vyos.vyos-4d9f13491531e968b4b30b32577eccb324cf23dd.zip | |
Update Unit Tests (#297)
* Remove Python < 3.6 wrappers
* Update imports
28 files changed, 45 insertions, 224 deletions
| diff --git a/tests/unit/compat/__init__.py b/tests/unit/compat/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/tests/unit/compat/__init__.py +++ /dev/null diff --git a/tests/unit/compat/builtins.py b/tests/unit/compat/builtins.py deleted file mode 100644 index bfc8adfb..00000000 --- a/tests/unit/compat/builtins.py +++ /dev/null @@ -1,34 +0,0 @@ -# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com> -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible.  If not, see <http://www.gnu.org/licenses/>. - -# Make coding more python3-ish -from __future__ import absolute_import, division, print_function - -__metaclass__ = type - -# -# Compat for python2.7 -# - -# One unittest needs to import builtins via __import__() so we need to have -# the string that represents it -try: -    import __builtin__ -except ImportError: -    BUILTINS = "builtins" -else: -    BUILTINS = "__builtin__" diff --git a/tests/unit/compat/mock.py b/tests/unit/compat/mock.py deleted file mode 100644 index 2c62c9ec..00000000 --- a/tests/unit/compat/mock.py +++ /dev/null @@ -1,125 +0,0 @@ -# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com> -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible.  If not, see <http://www.gnu.org/licenses/>. - -# Make coding more python3-ish -from __future__ import absolute_import, division, print_function - -__metaclass__ = type - -""" -Compat module for Python3.x's unittest.mock module -""" -import sys - -import _io - -# Python 2.7 - -# Note: Could use the pypi mock library on python3.x as well as python2.x.  It -# is the same as the python3 stdlib mock library - -try: -    # Allow wildcard import because we really do want to import all of mock's -    # symbols into this compat shim -    # pylint: disable=wildcard-import,unused-wildcard-import -    from unittest.mock import * -except ImportError: -    # Python 2 -    # pylint: disable=wildcard-import,unused-wildcard-import -    try: -        from mock import * -    except ImportError: -        print("You need the mock library installed on python2.x to run tests") - - -# Prior to 3.4.4, mock_open cannot handle binary read_data -if sys.version_info >= (3,) and sys.version_info < (3, 4, 4): -    file_spec = None - -    def _iterate_read_data(read_data): -        # Helper for mock_open: -        # Retrieve lines from read_data via a generator so that separate calls to -        # readline, read, and readlines are properly interleaved -        sep = b"\n" if isinstance(read_data, bytes) else "\n" -        data_as_list = [l + sep for l in read_data.split(sep)] - -        if data_as_list[-1] == sep: -            # If the last line ended in a newline, the list comprehension will have an -            # extra entry that's just a newline.  Remove this. -            data_as_list = data_as_list[:-1] -        else: -            # If there wasn't an extra newline by itself, then the file being -            # emulated doesn't have a newline to end the last line  remove the -            # newline that our naive format() added -            data_as_list[-1] = data_as_list[-1][:-1] - -        for line in data_as_list: -            yield line - -    def mock_open(mock=None, read_data=""): -        """ -        A helper function to create a mock to replace the use of `open`. It works -        for `open` called directly or used as a context manager. - -        The `mock` argument is the mock object to configure. If `None` (the -        default) then a `MagicMock` will be created for you, with the API limited -        to methods or attributes available on standard file handles. - -        `read_data` is a string for the `read` methoddline`, and `readlines` of the -        file handle to return.  This is an empty string by default. -        """ - -        def _readlines_side_effect(*args, **kwargs): -            if handle.readlines.return_value is not None: -                return handle.readlines.return_value -            return list(_data) - -        def _read_side_effect(*args, **kwargs): -            if handle.read.return_value is not None: -                return handle.read.return_value -            return type(read_data)().join(_data) - -        def _readline_side_effect(): -            if handle.readline.return_value is not None: -                while True: -                    yield handle.readline.return_value -            for line in _data: -                yield line - -        global file_spec -        if file_spec is None: -            file_spec = list(set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO)))) - -        if mock is None: -            mock = MagicMock(name="open", spec=open) - -        handle = MagicMock(spec=file_spec) -        handle.__enter__.return_value = handle - -        _data = _iterate_read_data(read_data) - -        handle.write.return_value = None -        handle.read.return_value = None -        handle.readline.return_value = None -        handle.readlines.return_value = None - -        handle.read.side_effect = _read_side_effect -        handle.readline.side_effect = _readline_side_effect() -        handle.readlines.side_effect = _readlines_side_effect - -        mock.return_value = handle -        return mock diff --git a/tests/unit/compat/unittest.py b/tests/unit/compat/unittest.py deleted file mode 100644 index df3379b8..00000000 --- a/tests/unit/compat/unittest.py +++ /dev/null @@ -1,39 +0,0 @@ -# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com> -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible.  If not, see <http://www.gnu.org/licenses/>. - -# Make coding more python3-ish -from __future__ import absolute_import, division, print_function - -__metaclass__ = type - -""" -Compat module for Python2.7's unittest module -""" - -import sys - -# Allow wildcard import because we really do want to import all of -# unittests's symbols into this compat shim -# pylint: disable=wildcard-import,unused-wildcard-import -if sys.version_info < (2, 7): -    try: -        # Need unittest2 on python2.6 -        from unittest2 import * -    except ImportError: -        print("You need unittest2 installed on python2.6.x to run tests") -else: -    from unittest import * diff --git a/tests/unit/modules/network/vyos/test_vyos_banner.py b/tests/unit/modules/network/vyos/test_vyos_banner.py index 1d6738ce..f054ee0b 100644 --- a/tests/unit/modules/network/vyos/test_vyos_banner.py +++ b/tests/unit/modules/network/vyos/test_vyos_banner.py @@ -18,8 +18,9 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type +from unittest.mock import patch +  from ansible_collections.vyos.vyos.plugins.modules import vyos_banner -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args  from .vyos_module import TestVyosModule diff --git a/tests/unit/modules/network/vyos/test_vyos_bgp_address_family.py b/tests/unit/modules/network/vyos/test_vyos_bgp_address_family.py index 0bbf74ae..9ef28aab 100644 --- a/tests/unit/modules/network/vyos/test_vyos_bgp_address_family.py +++ b/tests/unit/modules/network/vyos/test_vyos_bgp_address_family.py @@ -20,8 +20,9 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type +from unittest.mock import patch +  from ansible_collections.vyos.vyos.plugins.modules import vyos_bgp_address_family -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args  from .vyos_module import TestVyosModule, load_fixture diff --git a/tests/unit/modules/network/vyos/test_vyos_bgp_global.py b/tests/unit/modules/network/vyos/test_vyos_bgp_global.py index d0167de9..830fd386 100644 --- a/tests/unit/modules/network/vyos/test_vyos_bgp_global.py +++ b/tests/unit/modules/network/vyos/test_vyos_bgp_global.py @@ -20,8 +20,9 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type +from unittest.mock import patch +  from ansible_collections.vyos.vyos.plugins.modules import vyos_bgp_global -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args  from .vyos_module import TestVyosModule, load_fixture diff --git a/tests/unit/modules/network/vyos/test_vyos_command.py b/tests/unit/modules/network/vyos/test_vyos_command.py index 5479bbb4..40db1580 100644 --- a/tests/unit/modules/network/vyos/test_vyos_command.py +++ b/tests/unit/modules/network/vyos/test_vyos_command.py @@ -20,8 +20,9 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type +from unittest.mock import patch +  from ansible_collections.vyos.vyos.plugins.modules import vyos_command -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args  from .vyos_module import TestVyosModule, load_fixture diff --git a/tests/unit/modules/network/vyos/test_vyos_config.py b/tests/unit/modules/network/vyos/test_vyos_config.py index ca949c69..743acab0 100644 --- a/tests/unit/modules/network/vyos/test_vyos_config.py +++ b/tests/unit/modules/network/vyos/test_vyos_config.py @@ -21,9 +21,10 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type +from unittest.mock import MagicMock, patch +  from ansible_collections.vyos.vyos.plugins.cliconf.vyos import Cliconf  from ansible_collections.vyos.vyos.plugins.modules import vyos_config -from ansible_collections.vyos.vyos.tests.unit.compat.mock import MagicMock, patch  from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args  from .vyos_module import TestVyosModule, load_fixture diff --git a/tests/unit/modules/network/vyos/test_vyos_facts.py b/tests/unit/modules/network/vyos/test_vyos_facts.py index 727f69ba..691d7cff 100644 --- a/tests/unit/modules/network/vyos/test_vyos_facts.py +++ b/tests/unit/modules/network/vyos/test_vyos_facts.py @@ -19,9 +19,9 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type  import json +from unittest.mock import patch  from ansible_collections.vyos.vyos.plugins.modules import vyos_facts -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args  from .vyos_module import TestVyosModule, load_fixture diff --git a/tests/unit/modules/network/vyos/test_vyos_firewall_global.py b/tests/unit/modules/network/vyos/test_vyos_firewall_global.py index 8164768f..71b3a188 100644 --- a/tests/unit/modules/network/vyos/test_vyos_firewall_global.py +++ b/tests/unit/modules/network/vyos/test_vyos_firewall_global.py @@ -20,8 +20,9 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type +from unittest.mock import patch +  from ansible_collections.vyos.vyos.plugins.modules import vyos_firewall_global -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args  from .vyos_module import TestVyosModule, load_fixture diff --git a/tests/unit/modules/network/vyos/test_vyos_firewall_interfaces.py b/tests/unit/modules/network/vyos/test_vyos_firewall_interfaces.py index acb9894c..10d93cae 100644 --- a/tests/unit/modules/network/vyos/test_vyos_firewall_interfaces.py +++ b/tests/unit/modules/network/vyos/test_vyos_firewall_interfaces.py @@ -20,8 +20,9 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type +from unittest.mock import patch +  from ansible_collections.vyos.vyos.plugins.modules import vyos_firewall_interfaces -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args  from .vyos_module import TestVyosModule, load_fixture diff --git a/tests/unit/modules/network/vyos/test_vyos_firewall_rules.py b/tests/unit/modules/network/vyos/test_vyos_firewall_rules.py index 7952b471..18da6783 100644 --- a/tests/unit/modules/network/vyos/test_vyos_firewall_rules.py +++ b/tests/unit/modules/network/vyos/test_vyos_firewall_rules.py @@ -20,8 +20,9 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type +from unittest.mock import patch +  from ansible_collections.vyos.vyos.plugins.modules import vyos_firewall_rules -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args  from .vyos_module import TestVyosModule, load_fixture diff --git a/tests/unit/modules/network/vyos/test_vyos_hostname.py b/tests/unit/modules/network/vyos/test_vyos_hostname.py index 3df9a175..c7edc264 100644 --- a/tests/unit/modules/network/vyos/test_vyos_hostname.py +++ b/tests/unit/modules/network/vyos/test_vyos_hostname.py @@ -20,8 +20,9 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type +from unittest.mock import patch +  from ansible_collections.vyos.vyos.plugins.modules import vyos_hostname -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args  from .vyos_module import TestVyosModule, load_fixture diff --git a/tests/unit/modules/network/vyos/test_vyos_interfaces.py b/tests/unit/modules/network/vyos/test_vyos_interfaces.py index ea6dbf5d..06bbefa4 100644 --- a/tests/unit/modules/network/vyos/test_vyos_interfaces.py +++ b/tests/unit/modules/network/vyos/test_vyos_interfaces.py @@ -20,8 +20,9 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type +from unittest.mock import patch +  from ansible_collections.vyos.vyos.plugins.modules import vyos_interfaces -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args  from .vyos_module import TestVyosModule, load_fixture diff --git a/tests/unit/modules/network/vyos/test_vyos_logging_global.py b/tests/unit/modules/network/vyos/test_vyos_logging_global.py index f1ab00d2..209844e3 100644 --- a/tests/unit/modules/network/vyos/test_vyos_logging_global.py +++ b/tests/unit/modules/network/vyos/test_vyos_logging_global.py @@ -8,9 +8,9 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type  from textwrap import dedent +from unittest.mock import patch  from ansible_collections.vyos.vyos.plugins.modules import vyos_logging_global -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args  from .vyos_module import TestVyosModule diff --git a/tests/unit/modules/network/vyos/test_vyos_ntp_global.py b/tests/unit/modules/network/vyos/test_vyos_ntp_global.py index 5da1056a..37c851d8 100644 --- a/tests/unit/modules/network/vyos/test_vyos_ntp_global.py +++ b/tests/unit/modules/network/vyos/test_vyos_ntp_global.py @@ -20,8 +20,9 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type +from unittest.mock import patch +  from ansible_collections.vyos.vyos.plugins.modules import vyos_ntp_global -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args  from .vyos_module import TestVyosModule, load_fixture diff --git a/tests/unit/modules/network/vyos/test_vyos_ospf_interfaces.py b/tests/unit/modules/network/vyos/test_vyos_ospf_interfaces.py index 74eaf7c9..248b98ed 100644 --- a/tests/unit/modules/network/vyos/test_vyos_ospf_interfaces.py +++ b/tests/unit/modules/network/vyos/test_vyos_ospf_interfaces.py @@ -20,8 +20,9 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type +from unittest.mock import patch +  from ansible_collections.vyos.vyos.plugins.modules import vyos_ospf_interfaces -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args  from .vyos_module import TestVyosModule, load_fixture diff --git a/tests/unit/modules/network/vyos/test_vyos_ospfv2.py b/tests/unit/modules/network/vyos/test_vyos_ospfv2.py index 84b882db..d2ddb408 100644 --- a/tests/unit/modules/network/vyos/test_vyos_ospfv2.py +++ b/tests/unit/modules/network/vyos/test_vyos_ospfv2.py @@ -20,8 +20,9 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type +from unittest.mock import patch +  from ansible_collections.vyos.vyos.plugins.modules import vyos_ospfv2 -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args  from .vyos_module import TestVyosModule, load_fixture diff --git a/tests/unit/modules/network/vyos/test_vyos_ospfv3.py b/tests/unit/modules/network/vyos/test_vyos_ospfv3.py index 2231c0bd..00024517 100644 --- a/tests/unit/modules/network/vyos/test_vyos_ospfv3.py +++ b/tests/unit/modules/network/vyos/test_vyos_ospfv3.py @@ -20,8 +20,9 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type +from unittest.mock import patch +  from ansible_collections.vyos.vyos.plugins.modules import vyos_ospfv3 -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args  from .vyos_module import TestVyosModule, load_fixture diff --git a/tests/unit/modules/network/vyos/test_vyos_ping.py b/tests/unit/modules/network/vyos/test_vyos_ping.py index 612e50c9..25bb6cf2 100644 --- a/tests/unit/modules/network/vyos/test_vyos_ping.py +++ b/tests/unit/modules/network/vyos/test_vyos_ping.py @@ -20,8 +20,9 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type +from unittest.mock import patch +  from ansible_collections.vyos.vyos.plugins.modules import vyos_ping -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args  from .vyos_module import TestVyosModule, load_fixture diff --git a/tests/unit/modules/network/vyos/test_vyos_prefix_lists.py b/tests/unit/modules/network/vyos/test_vyos_prefix_lists.py index dafba2a9..5c488ec9 100644 --- a/tests/unit/modules/network/vyos/test_vyos_prefix_lists.py +++ b/tests/unit/modules/network/vyos/test_vyos_prefix_lists.py @@ -21,9 +21,9 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type  from textwrap import dedent +from unittest.mock import patch  from ansible_collections.vyos.vyos.plugins.modules import vyos_prefix_lists -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args  from .vyos_module import TestVyosModule diff --git a/tests/unit/modules/network/vyos/test_vyos_route_maps.py b/tests/unit/modules/network/vyos/test_vyos_route_maps.py index 9d3c71a9..adac6c31 100644 --- a/tests/unit/modules/network/vyos/test_vyos_route_maps.py +++ b/tests/unit/modules/network/vyos/test_vyos_route_maps.py @@ -20,8 +20,9 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type +from unittest.mock import patch +  from ansible_collections.vyos.vyos.plugins.modules import vyos_route_maps -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args  from .vyos_module import TestVyosModule, load_fixture diff --git a/tests/unit/modules/network/vyos/test_vyos_snmp_server.py b/tests/unit/modules/network/vyos/test_vyos_snmp_server.py index 73e29f65..b6d61b1b 100644 --- a/tests/unit/modules/network/vyos/test_vyos_snmp_server.py +++ b/tests/unit/modules/network/vyos/test_vyos_snmp_server.py @@ -20,8 +20,9 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type +from unittest.mock import patch +  from ansible_collections.vyos.vyos.plugins.modules import vyos_snmp_server -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args  from .vyos_module import TestVyosModule, load_fixture diff --git a/tests/unit/modules/network/vyos/test_vyos_static_routes.py b/tests/unit/modules/network/vyos/test_vyos_static_routes.py index 34790092..96137bda 100644 --- a/tests/unit/modules/network/vyos/test_vyos_static_routes.py +++ b/tests/unit/modules/network/vyos/test_vyos_static_routes.py @@ -20,8 +20,9 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type +from unittest.mock import patch +  from ansible_collections.vyos.vyos.plugins.modules import vyos_static_routes -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args  from .vyos_module import TestVyosModule, load_fixture diff --git a/tests/unit/modules/network/vyos/test_vyos_system.py b/tests/unit/modules/network/vyos/test_vyos_system.py index 03ef3df9..252172d6 100644 --- a/tests/unit/modules/network/vyos/test_vyos_system.py +++ b/tests/unit/modules/network/vyos/test_vyos_system.py @@ -20,8 +20,9 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type +from unittest.mock import patch +  from ansible_collections.vyos.vyos.plugins.modules import vyos_system -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args  from .vyos_module import TestVyosModule, load_fixture diff --git a/tests/unit/modules/network/vyos/test_vyos_user.py b/tests/unit/modules/network/vyos/test_vyos_user.py index 57639d15..23872967 100644 --- a/tests/unit/modules/network/vyos/test_vyos_user.py +++ b/tests/unit/modules/network/vyos/test_vyos_user.py @@ -20,8 +20,9 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type +from unittest.mock import patch +  from ansible_collections.vyos.vyos.plugins.modules import vyos_user -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args  from .vyos_module import TestVyosModule, load_fixture diff --git a/tests/unit/modules/utils.py b/tests/unit/modules/utils.py index 779c68fe..a7dd0b3a 100644 --- a/tests/unit/modules/utils.py +++ b/tests/unit/modules/utils.py @@ -2,13 +2,12 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type  import json +import unittest +from unittest.mock import patch  from ansible.module_utils import basic  from ansible.module_utils._text import to_bytes -from ansible_collections.vyos.vyos.tests.unit.compat import unittest -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch -  def set_module_args(args):      if "_ansible_remote_tmp" not in args: | 
