diff options
author | Matt Clay <matt@mystile.com> | 2023-11-02 00:28:38 +0100 |
---|---|---|
committer | Matt Clay <matt@mystile.com> | 2023-11-02 01:05:36 +0100 |
commit | 5b1b0ce7628ec1052d06f62719f36e212e962098 (patch) | |
tree | d7619250d4cd11069a1b779f48d9d8fdabb07d05 /test/units/modules | |
parent | Remove Python 2.x compat from unit tests (#82109) (diff) | |
download | ansible-5b1b0ce7628ec1052d06f62719f36e212e962098.tar.xz ansible-5b1b0ce7628ec1052d06f62719f36e212e962098.zip |
Remove Python 2 compat (via six) from unit tests
Diffstat (limited to 'test/units/modules')
-rw-r--r-- | test/units/modules/test_hostname.py | 3 | ||||
-rw-r--r-- | test/units/modules/test_service.py | 3 |
2 files changed, 1 insertions, 5 deletions
diff --git a/test/units/modules/test_hostname.py b/test/units/modules/test_hostname.py index ff5f789aa2..20b8336597 100644 --- a/test/units/modules/test_hostname.py +++ b/test/units/modules/test_hostname.py @@ -8,7 +8,6 @@ from unittest.mock import patch, MagicMock, mock_open from ansible.module_utils.common._utils import get_all_subclasses from ansible.modules import hostname from units.modules.utils import ModuleTestCase, set_module_args -from ansible.module_utils.six import PY2 class TestHostname(ModuleTestCase): @@ -27,8 +26,6 @@ class TestHostname(ModuleTestCase): m = mock_open() builtins = 'builtins' - if PY2: - builtins = '__builtin__' with patch('%s.open' % builtins, m): instance.get_permanent_hostname() instance.get_current_hostname() diff --git a/test/units/modules/test_service.py b/test/units/modules/test_service.py index 9e71186316..684645ee23 100644 --- a/test/units/modules/test_service.py +++ b/test/units/modules/test_service.py @@ -11,7 +11,6 @@ import platform import pytest from ansible.modules import service from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.six import PY2 from units.modules.utils import set_module_args @@ -28,7 +27,7 @@ def mocker_sunos_service(mocker): # Read a mocked /etc/release file mocked_etc_release_data = mocker.mock_open( read_data=" Oracle Solaris 12.0") - builtin_open = "__builtin__.open" if PY2 else "builtins.open" + builtin_open = "builtins.open" mocker.patch(builtin_open, mocked_etc_release_data) service_status = mocker.patch.object( |