summaryrefslogtreecommitdiffstats
path: root/test/units/module_utils
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2023-11-02 00:37:08 +0100
committerGitHub <noreply@github.com>2023-11-02 00:37:08 +0100
commit18e8401edd5357d1d9995ab6b44d7ff8d1702957 (patch)
treec45b1fbcb32a85e7208f262a8a0cbb3f3037d6ac /test/units/module_utils
parentpip - Add module in venv example (diff)
downloadansible-18e8401edd5357d1d9995ab6b44d7ff8d1702957.tar.xz
ansible-18e8401edd5357d1d9995ab6b44d7ff8d1702957.zip
Remove Python 2.x compat from unit tests (#82109)
Diffstat (limited to 'test/units/module_utils')
-rw-r--r--test/units/module_utils/basic/test_argument_spec.py2
-rw-r--r--test/units/module_utils/basic/test_filesystem.py2
-rw-r--r--test/units/module_utils/basic/test_get_module_path.py2
-rw-r--r--test/units/module_utils/basic/test_heuristic_log_sanitize.py2
-rw-r--r--test/units/module_utils/basic/test_imports.py2
-rw-r--r--test/units/module_utils/basic/test_no_log.py2
-rw-r--r--test/units/module_utils/basic/test_platform_distribution.py2
-rw-r--r--test/units/module_utils/basic/test_selinux.py2
-rw-r--r--test/units/module_utils/basic/test_set_cwd.py2
-rw-r--r--test/units/module_utils/basic/test_tmpdir.py2
-rw-r--r--test/units/module_utils/common/test_locale.py2
-rw-r--r--test/units/module_utils/common/test_sys_info.py2
-rw-r--r--test/units/module_utils/facts/base.py4
-rw-r--r--test/units/module_utils/facts/hardware/test_linux.py4
-rw-r--r--test/units/module_utils/facts/network/test_fc_wwn.py2
-rw-r--r--test/units/module_utils/facts/network/test_generic_bsd.py4
-rw-r--r--test/units/module_utils/facts/network/test_iscsi_get_initiator.py2
-rw-r--r--test/units/module_utils/facts/network/test_locally_reachable_ips.py4
-rw-r--r--test/units/module_utils/facts/other/test_facter.py2
-rw-r--r--test/units/module_utils/facts/other/test_ohai.py2
-rw-r--r--test/units/module_utils/facts/system/distribution/conftest.py2
-rw-r--r--test/units/module_utils/facts/system/test_lsb.py2
-rw-r--r--test/units/module_utils/facts/test_ansible_collector.py4
-rw-r--r--test/units/module_utils/facts/test_collector.py2
-rw-r--r--test/units/module_utils/facts/test_collectors.py2
-rw-r--r--test/units/module_utils/facts/test_facts.py4
-rw-r--r--test/units/module_utils/facts/test_sysctl.py4
-rw-r--r--test/units/module_utils/facts/test_utils.py4
-rw-r--r--test/units/module_utils/json_utils/test_filter_non_json_lines.py2
-rw-r--r--test/units/module_utils/urls/test_Request.py2
-rw-r--r--test/units/module_utils/urls/test_fetch_url.py2
31 files changed, 39 insertions, 39 deletions
diff --git a/test/units/module_utils/basic/test_argument_spec.py b/test/units/module_utils/basic/test_argument_spec.py
index 28568b80af..e651ad6e2a 100644
--- a/test/units/module_utils/basic/test_argument_spec.py
+++ b/test/units/module_utils/basic/test_argument_spec.py
@@ -11,7 +11,7 @@ import os
import pytest
-from units.compat.mock import MagicMock
+from unittest.mock import MagicMock
from ansible.module_utils import basic
from ansible.module_utils.api import basic_auth_argument_spec, rate_limit_argument_spec, retry_argument_spec
from ansible.module_utils.common import warnings
diff --git a/test/units/module_utils/basic/test_filesystem.py b/test/units/module_utils/basic/test_filesystem.py
index c08b493f70..109ba62398 100644
--- a/test/units/module_utils/basic/test_filesystem.py
+++ b/test/units/module_utils/basic/test_filesystem.py
@@ -8,7 +8,7 @@ from __future__ import annotations
from units.mock.procenv import ModuleTestCase
-from units.compat.mock import patch, MagicMock
+from unittest.mock import patch, MagicMock
from ansible.module_utils.six.moves import builtins
realimport = builtins.__import__
diff --git a/test/units/module_utils/basic/test_get_module_path.py b/test/units/module_utils/basic/test_get_module_path.py
index 864030c5fa..5ba40c4095 100644
--- a/test/units/module_utils/basic/test_get_module_path.py
+++ b/test/units/module_utils/basic/test_get_module_path.py
@@ -8,7 +8,7 @@ from __future__ import annotations
from units.mock.procenv import ModuleTestCase
-from units.compat.mock import patch
+from unittest.mock import patch
from ansible.module_utils.six.moves import builtins
realimport = builtins.__import__
diff --git a/test/units/module_utils/basic/test_heuristic_log_sanitize.py b/test/units/module_utils/basic/test_heuristic_log_sanitize.py
index debbda73d4..2c4eefba4a 100644
--- a/test/units/module_utils/basic/test_heuristic_log_sanitize.py
+++ b/test/units/module_utils/basic/test_heuristic_log_sanitize.py
@@ -18,7 +18,7 @@
from __future__ import annotations
-from units.compat import unittest
+import unittest
from ansible.module_utils.basic import heuristic_log_sanitize
diff --git a/test/units/module_utils/basic/test_imports.py b/test/units/module_utils/basic/test_imports.py
index 0d4f0027b8..282a8d45f4 100644
--- a/test/units/module_utils/basic/test_imports.py
+++ b/test/units/module_utils/basic/test_imports.py
@@ -10,7 +10,7 @@ import sys
from units.mock.procenv import ModuleTestCase
-from units.compat.mock import patch
+from unittest.mock import patch
from ansible.module_utils.six.moves import builtins
realimport = builtins.__import__
diff --git a/test/units/module_utils/basic/test_no_log.py b/test/units/module_utils/basic/test_no_log.py
index 698c38eed6..0b04a74e38 100644
--- a/test/units/module_utils/basic/test_no_log.py
+++ b/test/units/module_utils/basic/test_no_log.py
@@ -5,7 +5,7 @@
from __future__ import annotations
-from units.compat import unittest
+import unittest
from ansible.module_utils.basic import remove_values
from ansible.module_utils.common.parameters import _return_datastructure_name
diff --git a/test/units/module_utils/basic/test_platform_distribution.py b/test/units/module_utils/basic/test_platform_distribution.py
index a9b623cece..00c0e49692 100644
--- a/test/units/module_utils/basic/test_platform_distribution.py
+++ b/test/units/module_utils/basic/test_platform_distribution.py
@@ -8,7 +8,7 @@ from __future__ import annotations
import pytest
-from units.compat.mock import patch
+from unittest.mock import patch
from ansible.module_utils.six.moves import builtins
diff --git a/test/units/module_utils/basic/test_selinux.py b/test/units/module_utils/basic/test_selinux.py
index 57598e2079..1851616b3e 100644
--- a/test/units/module_utils/basic/test_selinux.py
+++ b/test/units/module_utils/basic/test_selinux.py
@@ -10,7 +10,7 @@ import errno
import json
import pytest
-from units.compat.mock import mock_open, patch
+from unittest.mock import mock_open, patch
from ansible.module_utils import basic
from ansible.module_utils.common.text.converters import to_bytes
diff --git a/test/units/module_utils/basic/test_set_cwd.py b/test/units/module_utils/basic/test_set_cwd.py
index 4542b2eb91..b060b50b1f 100644
--- a/test/units/module_utils/basic/test_set_cwd.py
+++ b/test/units/module_utils/basic/test_set_cwd.py
@@ -8,7 +8,7 @@ import json
import os
import tempfile
-from units.compat.mock import patch
+from unittest.mock import patch
from ansible.module_utils.common.text.converters import to_bytes
from ansible.module_utils import basic
diff --git a/test/units/module_utils/basic/test_tmpdir.py b/test/units/module_utils/basic/test_tmpdir.py
index 3f51f56f49..0e4f53d711 100644
--- a/test/units/module_utils/basic/test_tmpdir.py
+++ b/test/units/module_utils/basic/test_tmpdir.py
@@ -11,7 +11,7 @@ import tempfile
import pytest
-from units.compat.mock import patch, MagicMock
+from unittest.mock import patch, MagicMock
from ansible.module_utils.common.text.converters import to_bytes
from ansible.module_utils import basic
diff --git a/test/units/module_utils/common/test_locale.py b/test/units/module_utils/common/test_locale.py
index 25625bdc87..80e28de027 100644
--- a/test/units/module_utils/common/test_locale.py
+++ b/test/units/module_utils/common/test_locale.py
@@ -4,7 +4,7 @@
from __future__ import annotations
-from units.compat.mock import MagicMock
+from unittest.mock import MagicMock
from ansible.module_utils.common.locale import get_best_parsable_locale
diff --git a/test/units/module_utils/common/test_sys_info.py b/test/units/module_utils/common/test_sys_info.py
index 4dfc59ac21..1878fafb8e 100644
--- a/test/units/module_utils/common/test_sys_info.py
+++ b/test/units/module_utils/common/test_sys_info.py
@@ -8,7 +8,7 @@ from __future__ import annotations
import pytest
-from units.compat.mock import patch
+from unittest.mock import patch
from ansible.module_utils.six.moves import builtins
diff --git a/test/units/module_utils/facts/base.py b/test/units/module_utils/facts/base.py
index f180ec65ba..4a19e67d5f 100644
--- a/test/units/module_utils/facts/base.py
+++ b/test/units/module_utils/facts/base.py
@@ -17,8 +17,8 @@
from __future__ import annotations
-from units.compat import unittest
-from units.compat.mock import Mock, patch
+import unittest
+from unittest.mock import Mock, patch
class BaseFactsTest(unittest.TestCase):
diff --git a/test/units/module_utils/facts/hardware/test_linux.py b/test/units/module_utils/facts/hardware/test_linux.py
index 2745d9e535..0a546f1516 100644
--- a/test/units/module_utils/facts/hardware/test_linux.py
+++ b/test/units/module_utils/facts/hardware/test_linux.py
@@ -17,8 +17,8 @@ from __future__ import annotations
import os
-from units.compat import unittest
-from units.compat.mock import Mock, patch
+import unittest
+from unittest.mock import Mock, patch
from ansible.module_utils.facts import timeout
diff --git a/test/units/module_utils/facts/network/test_fc_wwn.py b/test/units/module_utils/facts/network/test_fc_wwn.py
index 9a88371044..3f91654fec 100644
--- a/test/units/module_utils/facts/network/test_fc_wwn.py
+++ b/test/units/module_utils/facts/network/test_fc_wwn.py
@@ -5,7 +5,7 @@
from __future__ import annotations
from ansible.module_utils.facts.network import fc_wwn
-from units.compat.mock import Mock
+from unittest.mock import Mock
# AIX lsdev
diff --git a/test/units/module_utils/facts/network/test_generic_bsd.py b/test/units/module_utils/facts/network/test_generic_bsd.py
index d1e94714b6..4e4061dbb7 100644
--- a/test/units/module_utils/facts/network/test_generic_bsd.py
+++ b/test/units/module_utils/facts/network/test_generic_bsd.py
@@ -16,8 +16,8 @@
from __future__ import annotations
-from units.compat.mock import Mock
-from units.compat import unittest
+from unittest.mock import Mock
+import unittest
from ansible.module_utils.facts.network import generic_bsd
diff --git a/test/units/module_utils/facts/network/test_iscsi_get_initiator.py b/test/units/module_utils/facts/network/test_iscsi_get_initiator.py
index 9e9eec7e9c..48f97b38fa 100644
--- a/test/units/module_utils/facts/network/test_iscsi_get_initiator.py
+++ b/test/units/module_utils/facts/network/test_iscsi_get_initiator.py
@@ -5,7 +5,7 @@
from __future__ import annotations
from ansible.module_utils.facts.network import iscsi
-from units.compat.mock import Mock
+from unittest.mock import Mock
# AIX # lsattr -E -l iscsi0
diff --git a/test/units/module_utils/facts/network/test_locally_reachable_ips.py b/test/units/module_utils/facts/network/test_locally_reachable_ips.py
index 116d86e1dd..4c3643ae23 100644
--- a/test/units/module_utils/facts/network/test_locally_reachable_ips.py
+++ b/test/units/module_utils/facts/network/test_locally_reachable_ips.py
@@ -18,8 +18,8 @@
from __future__ import annotations
-from units.compat.mock import Mock
-from units.compat import unittest
+from unittest.mock import Mock
+import unittest
from ansible.module_utils.facts.network import linux
# ip -4 route show table local
diff --git a/test/units/module_utils/facts/other/test_facter.py b/test/units/module_utils/facts/other/test_facter.py
index 706bbaf99b..62ff5196cc 100644
--- a/test/units/module_utils/facts/other/test_facter.py
+++ b/test/units/module_utils/facts/other/test_facter.py
@@ -17,7 +17,7 @@
from __future__ import annotations
-from units.compat.mock import Mock, patch
+from unittest.mock import Mock, patch
from .. base import BaseFactsTest
diff --git a/test/units/module_utils/facts/other/test_ohai.py b/test/units/module_utils/facts/other/test_ohai.py
index 0093166dff..f5084c5d45 100644
--- a/test/units/module_utils/facts/other/test_ohai.py
+++ b/test/units/module_utils/facts/other/test_ohai.py
@@ -17,7 +17,7 @@
from __future__ import annotations
-from units.compat.mock import Mock, patch
+from unittest.mock import Mock, patch
from .. base import BaseFactsTest
diff --git a/test/units/module_utils/facts/system/distribution/conftest.py b/test/units/module_utils/facts/system/distribution/conftest.py
index 580467bd4b..9f84822d5f 100644
--- a/test/units/module_utils/facts/system/distribution/conftest.py
+++ b/test/units/module_utils/facts/system/distribution/conftest.py
@@ -7,7 +7,7 @@ from __future__ import annotations
import pytest
-from units.compat.mock import Mock
+from unittest.mock import Mock
@pytest.fixture
diff --git a/test/units/module_utils/facts/system/test_lsb.py b/test/units/module_utils/facts/system/test_lsb.py
index 4049aa0836..385a754079 100644
--- a/test/units/module_utils/facts/system/test_lsb.py
+++ b/test/units/module_utils/facts/system/test_lsb.py
@@ -17,7 +17,7 @@
from __future__ import annotations
-from units.compat.mock import Mock, patch
+from unittest.mock import Mock, patch
from .. base import BaseFactsTest
diff --git a/test/units/module_utils/facts/test_ansible_collector.py b/test/units/module_utils/facts/test_ansible_collector.py
index be44a670cf..3316464c47 100644
--- a/test/units/module_utils/facts/test_ansible_collector.py
+++ b/test/units/module_utils/facts/test_ansible_collector.py
@@ -18,8 +18,8 @@
from __future__ import annotations
# for testing
-from units.compat import unittest
-from units.compat.mock import Mock, patch
+import unittest
+from unittest.mock import Mock, patch
from ansible.module_utils.facts import collector
from ansible.module_utils.facts import ansible_collector
diff --git a/test/units/module_utils/facts/test_collector.py b/test/units/module_utils/facts/test_collector.py
index 21e2400141..852273c366 100644
--- a/test/units/module_utils/facts/test_collector.py
+++ b/test/units/module_utils/facts/test_collector.py
@@ -22,7 +22,7 @@ from collections import defaultdict
import pprint
# for testing
-from units.compat import unittest
+import unittest
from ansible.module_utils.facts import collector
diff --git a/test/units/module_utils/facts/test_collectors.py b/test/units/module_utils/facts/test_collectors.py
index a889a07008..8ad0025787 100644
--- a/test/units/module_utils/facts/test_collectors.py
+++ b/test/units/module_utils/facts/test_collectors.py
@@ -19,7 +19,7 @@ from __future__ import annotations
import pytest
-from units.compat.mock import Mock, patch
+from unittest.mock import Mock, patch
from . base import BaseFactsTest
diff --git a/test/units/module_utils/facts/test_facts.py b/test/units/module_utils/facts/test_facts.py
index 06cee74b5c..d0381a1ef4 100644
--- a/test/units/module_utils/facts/test_facts.py
+++ b/test/units/module_utils/facts/test_facts.py
@@ -23,8 +23,8 @@ import os
import pytest
# for testing
-from units.compat import unittest
-from units.compat.mock import Mock, patch
+import unittest
+from unittest.mock import Mock, patch
from ansible.module_utils import facts
from ansible.module_utils.facts import hardware
diff --git a/test/units/module_utils/facts/test_sysctl.py b/test/units/module_utils/facts/test_sysctl.py
index 39c6a89d43..4fed2dbdda 100644
--- a/test/units/module_utils/facts/test_sysctl.py
+++ b/test/units/module_utils/facts/test_sysctl.py
@@ -19,8 +19,8 @@
from __future__ import annotations
# for testing
-from units.compat import unittest
-from units.compat.mock import MagicMock
+import unittest
+from unittest.mock import MagicMock
from ansible.module_utils.facts.sysctl import get_sysctl
diff --git a/test/units/module_utils/facts/test_utils.py b/test/units/module_utils/facts/test_utils.py
index 07921409c6..5accfe9e5a 100644
--- a/test/units/module_utils/facts/test_utils.py
+++ b/test/units/module_utils/facts/test_utils.py
@@ -15,8 +15,8 @@
from __future__ import annotations
-from units.compat import unittest
-from units.compat.mock import patch
+import unittest
+from unittest.mock import patch
from ansible.module_utils.facts import utils
diff --git a/test/units/module_utils/json_utils/test_filter_non_json_lines.py b/test/units/module_utils/json_utils/test_filter_non_json_lines.py
index 9dad631f70..53582cc5e6 100644
--- a/test/units/module_utils/json_utils/test_filter_non_json_lines.py
+++ b/test/units/module_utils/json_utils/test_filter_non_json_lines.py
@@ -18,7 +18,7 @@
from __future__ import annotations
-from units.compat import unittest
+import unittest
from ansible.module_utils.json_utils import _filter_non_json_lines
diff --git a/test/units/module_utils/urls/test_Request.py b/test/units/module_utils/urls/test_Request.py
index 9bf04020b0..b827dd5bcb 100644
--- a/test/units/module_utils/urls/test_Request.py
+++ b/test/units/module_utils/urls/test_Request.py
@@ -14,7 +14,7 @@ from ansible.module_utils.urls import (Request, open_url, cookiejar,
from ansible.module_utils.urls import HTTPRedirectHandler
import pytest
-from units.compat.mock import call
+from unittest.mock import call
import ssl
diff --git a/test/units/module_utils/urls/test_fetch_url.py b/test/units/module_utils/urls/test_fetch_url.py
index d29a3999f6..9df410263f 100644
--- a/test/units/module_utils/urls/test_fetch_url.py
+++ b/test/units/module_utils/urls/test_fetch_url.py
@@ -14,7 +14,7 @@ from http.cookiejar import Cookie
from ansible.module_utils.urls import fetch_url, ConnectionError
import pytest
-from units.compat.mock import MagicMock
+from unittest.mock import MagicMock
class AnsibleModuleExit(Exception):