summaryrefslogtreecommitdiffstats
path: root/test/units/module_utils
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2018-10-13 05:01:14 +0200
committerGitHub <noreply@github.com>2018-10-13 05:01:14 +0200
commit3033fd96b09b4c6bb2536d08634fc45728feab88 (patch)
treecf917cec18513bbfddf4bf8df4e8ec7c317ef4da /test/units/module_utils
parentwin test: add http tester container to Windows tests (#46606) (diff)
downloadansible-3033fd96b09b4c6bb2536d08634fc45728feab88.tar.xz
ansible-3033fd96b09b4c6bb2536d08634fc45728feab88.zip
Move unit test compat code out of `lib/ansible/`. (#46996)
* Move ansible.compat.tests to test/units/compat/. * Fix unit test references to ansible.compat.tests. * Move builtins compat to separate file. * Fix classification of test/units/compat/ dir.
Diffstat (limited to 'test/units/module_utils')
-rw-r--r--test/units/module_utils/aws/test_aws_module.py2
-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.py4
-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_tmpdir.py2
-rw-r--r--test/units/module_utils/cloud/test_backoff.py2
-rw-r--r--test/units/module_utils/common/test_dict_transformations.py2
-rw-r--r--test/units/module_utils/ec2/test_aws.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_generic_bsd.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/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_timeout.py4
-rw-r--r--test/units/module_utils/facts/test_utils.py4
-rw-r--r--test/units/module_utils/gcp/test_auth.py2
-rw-r--r--test/units/module_utils/gcp/test_gcp_utils.py2
-rw-r--r--test/units/module_utils/gcp/test_utils.py2
-rw-r--r--test/units/module_utils/json_utils/test_filter_non_json_lines.py2
-rw-r--r--test/units/module_utils/net_tools/nios/test_api.py4
-rw-r--r--test/units/module_utils/network/aci/test_aci.py2
-rw-r--r--test/units/module_utils/network/common/test_parsing.py2
-rw-r--r--test/units/module_utils/network/ftd/test_configuration.py4
-rw-r--r--test/units/module_utils/network/nos/test_nos.py2
-rw-r--r--test/units/module_utils/network/nso/test_nso.py4
-rw-r--r--test/units/module_utils/network/slxos/test_slxos.py2
-rw-r--r--test/units/module_utils/test_postgresql.py4
37 files changed, 49 insertions, 49 deletions
diff --git a/test/units/module_utils/aws/test_aws_module.py b/test/units/module_utils/aws/test_aws_module.py
index 9539a2dc93..425282cc54 100644
--- a/test/units/module_utils/aws/test_aws_module.py
+++ b/test/units/module_utils/aws/test_aws_module.py
@@ -23,7 +23,7 @@ import unittest
from ansible.module_utils import basic
from ansible.module_utils.aws.core import AnsibleAWSModule
from ansible.module_utils._text import to_bytes
-from ansible.compat.tests.mock import Mock, patch
+from units.compat.mock import Mock, patch
import json
importorskip("boto3")
diff --git a/test/units/module_utils/basic/test_argument_spec.py b/test/units/module_utils/basic/test_argument_spec.py
index 18ccd845e9..fd16dc6f6f 100644
--- a/test/units/module_utils/basic/test_argument_spec.py
+++ b/test/units/module_utils/basic/test_argument_spec.py
@@ -12,7 +12,7 @@ import os
import pytest
-from ansible.compat.tests.mock import MagicMock, patch
+from units.compat.mock import MagicMock, patch
from ansible.module_utils import basic
from ansible.module_utils.six import string_types
from ansible.module_utils.six.moves import builtins
diff --git a/test/units/module_utils/basic/test_filesystem.py b/test/units/module_utils/basic/test_filesystem.py
index abe52c14ea..37d1c5537a 100644
--- a/test/units/module_utils/basic/test_filesystem.py
+++ b/test/units/module_utils/basic/test_filesystem.py
@@ -9,7 +9,7 @@ __metaclass__ = type
from units.mock.procenv import ModuleTestCase
-from ansible.compat.tests.mock import patch, MagicMock
+from units.compat.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 641aed9a3c..6ff4a3bc71 100644
--- a/test/units/module_utils/basic/test_get_module_path.py
+++ b/test/units/module_utils/basic/test_get_module_path.py
@@ -9,7 +9,7 @@ __metaclass__ = type
from units.mock.procenv import ModuleTestCase
-from ansible.compat.tests.mock import patch
+from units.compat.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 19345bd4b2..799facc6b8 100644
--- a/test/units/module_utils/basic/test_heuristic_log_sanitize.py
+++ b/test/units/module_utils/basic/test_heuristic_log_sanitize.py
@@ -20,7 +20,7 @@
from __future__ import (absolute_import, division)
__metaclass__ = type
-from ansible.compat.tests import unittest
+from units.compat 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 0a0f8333f6..25dfb01e64 100644
--- a/test/units/module_utils/basic/test_imports.py
+++ b/test/units/module_utils/basic/test_imports.py
@@ -11,8 +11,8 @@ import sys
from units.mock.procenv import ModuleTestCase
-from ansible.compat.tests import unittest
-from ansible.compat.tests.mock import patch, MagicMock
+from units.compat import unittest
+from units.compat.mock import patch, MagicMock
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 ebd66a3756..1de31c67df 100644
--- a/test/units/module_utils/basic/test_no_log.py
+++ b/test/units/module_utils/basic/test_no_log.py
@@ -6,7 +6,7 @@
from __future__ import absolute_import, division, print_function
__metaclass__ = type
-from ansible.compat.tests import unittest
+from units.compat import unittest
from ansible.module_utils.basic import return_values, remove_values
diff --git a/test/units/module_utils/basic/test_platform_distribution.py b/test/units/module_utils/basic/test_platform_distribution.py
index a1a00b2bb9..ce202ba6ce 100644
--- a/test/units/module_utils/basic/test_platform_distribution.py
+++ b/test/units/module_utils/basic/test_platform_distribution.py
@@ -9,7 +9,7 @@ __metaclass__ = type
from units.mock.procenv import ModuleTestCase
-from ansible.compat.tests.mock import patch
+from units.compat.mock import patch
from ansible.module_utils.six.moves import builtins
realimport = builtins.__import__
diff --git a/test/units/module_utils/basic/test_selinux.py b/test/units/module_utils/basic/test_selinux.py
index df6ec9d0e8..8562eb881a 100644
--- a/test/units/module_utils/basic/test_selinux.py
+++ b/test/units/module_utils/basic/test_selinux.py
@@ -12,7 +12,7 @@ import json
from units.mock.procenv import ModuleTestCase, swap_stdin_and_argv
-from ansible.compat.tests.mock import patch, MagicMock, mock_open, Mock
+from units.compat.mock import patch, MagicMock, mock_open, Mock
from ansible.module_utils.six.moves import builtins
realimport = builtins.__import__
diff --git a/test/units/module_utils/basic/test_tmpdir.py b/test/units/module_utils/basic/test_tmpdir.py
index 20b529893a..40cd0d161f 100644
--- a/test/units/module_utils/basic/test_tmpdir.py
+++ b/test/units/module_utils/basic/test_tmpdir.py
@@ -13,7 +13,7 @@ import tempfile
import pytest
-from ansible.compat.tests.mock import patch, MagicMock
+from units.compat.mock import patch, MagicMock
from ansible.module_utils._text import to_bytes
from ansible.module_utils import basic
diff --git a/test/units/module_utils/cloud/test_backoff.py b/test/units/module_utils/cloud/test_backoff.py
index 7a128f980e..7a6a3a3c98 100644
--- a/test/units/module_utils/cloud/test_backoff.py
+++ b/test/units/module_utils/cloud/test_backoff.py
@@ -1,6 +1,6 @@
import random
-from ansible.compat.tests import unittest
+from units.compat import unittest
from ansible.module_utils.cloud import _exponential_backoff, \
_full_jitter_backoff
diff --git a/test/units/module_utils/common/test_dict_transformations.py b/test/units/module_utils/common/test_dict_transformations.py
index 6756a2b54f..6412cc17ff 100644
--- a/test/units/module_utils/common/test_dict_transformations.py
+++ b/test/units/module_utils/common/test_dict_transformations.py
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
-from ansible.compat.tests import unittest
+from units.compat import unittest
from ansible.module_utils.common.dict_transformations import _camel_to_snake, _snake_to_camel, camel_dict_to_snake_dict, dict_merge
EXPECTED_SNAKIFICATION = {
diff --git a/test/units/module_utils/ec2/test_aws.py b/test/units/module_utils/ec2/test_aws.py
index 5610d424c4..fdc1b36676 100644
--- a/test/units/module_utils/ec2/test_aws.py
+++ b/test/units/module_utils/ec2/test_aws.py
@@ -25,7 +25,7 @@ except:
from nose.plugins.skip import SkipTest
-from ansible.compat.tests import unittest
+from units.compat import unittest
from ansible.module_utils.ec2 import AWSRetry
if not HAS_BOTO3:
diff --git a/test/units/module_utils/facts/base.py b/test/units/module_utils/facts/base.py
index 8b32c5352b..04e00d12d8 100644
--- a/test/units/module_utils/facts/base.py
+++ b/test/units/module_utils/facts/base.py
@@ -19,8 +19,8 @@
from __future__ import (absolute_import, division)
__metaclass__ = type
-from ansible.compat.tests import unittest
-from ansible.compat.tests.mock import Mock
+from units.compat import unittest
+from units.compat.mock import Mock
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 f581c8068b..20e65b5fcc 100644
--- a/test/units/module_utils/facts/hardware/test_linux.py
+++ b/test/units/module_utils/facts/hardware/test_linux.py
@@ -18,8 +18,8 @@ __metaclass__ = type
import os
-from ansible.compat.tests import unittest
-from ansible.compat.tests.mock import Mock, patch
+from units.compat import unittest
+from units.compat.mock import Mock, patch
from ansible.module_utils.facts import timeout
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 45b4d75944..d62a8a4d50 100644
--- a/test/units/module_utils/facts/network/test_generic_bsd.py
+++ b/test/units/module_utils/facts/network/test_generic_bsd.py
@@ -18,8 +18,8 @@
from __future__ import (absolute_import, division)
__metaclass__ = type
-from ansible.compat.tests.mock import Mock
-from ansible.compat.tests import unittest
+from units.compat.mock import Mock
+from units.compat import unittest
from ansible.module_utils.facts.network import generic_bsd
diff --git a/test/units/module_utils/facts/other/test_facter.py b/test/units/module_utils/facts/other/test_facter.py
index eac6abf712..b18fa1135f 100644
--- a/test/units/module_utils/facts/other/test_facter.py
+++ b/test/units/module_utils/facts/other/test_facter.py
@@ -19,7 +19,7 @@
from __future__ import (absolute_import, division)
__metaclass__ = type
-from ansible.compat.tests.mock import Mock, patch
+from units.compat.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 f556765600..2c15cc5b3b 100644
--- a/test/units/module_utils/facts/other/test_ohai.py
+++ b/test/units/module_utils/facts/other/test_ohai.py
@@ -19,7 +19,7 @@
from __future__ import (absolute_import, division)
__metaclass__ = type
-from ansible.compat.tests.mock import Mock, patch
+from units.compat.mock import Mock, patch
from .. base import BaseFactsTest
diff --git a/test/units/module_utils/facts/system/test_lsb.py b/test/units/module_utils/facts/system/test_lsb.py
index 6bc5347037..dd5188b2fd 100644
--- a/test/units/module_utils/facts/system/test_lsb.py
+++ b/test/units/module_utils/facts/system/test_lsb.py
@@ -19,7 +19,7 @@
from __future__ import (absolute_import, division)
__metaclass__ = type
-from ansible.compat.tests.mock import Mock, patch
+from units.compat.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 5117209095..781a896810 100644
--- a/test/units/module_utils/facts/test_ansible_collector.py
+++ b/test/units/module_utils/facts/test_ansible_collector.py
@@ -20,8 +20,8 @@ from __future__ import (absolute_import, division)
__metaclass__ = type
# for testing
-from ansible.compat.tests import unittest
-from ansible.compat.tests.mock import Mock, patch
+from units.compat import unittest
+from units.compat.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 76f37f3ceb..a8cf0bc691 100644
--- a/test/units/module_utils/facts/test_collector.py
+++ b/test/units/module_utils/facts/test_collector.py
@@ -24,7 +24,7 @@ from collections import defaultdict
import pprint
# for testing
-from ansible.compat.tests import unittest
+from units.compat 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 668344d368..58f62d3926 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 (absolute_import, division)
__metaclass__ = type
-from ansible.compat.tests.mock import Mock, patch
+from units.compat.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 d83058bb92..a037ee0ce3 100644
--- a/test/units/module_utils/facts/test_facts.py
+++ b/test/units/module_utils/facts/test_facts.py
@@ -25,8 +25,8 @@ import os
import pytest
# for testing
-from ansible.compat.tests import unittest
-from ansible.compat.tests.mock import Mock, patch
+from units.compat import unittest
+from units.compat.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_timeout.py b/test/units/module_utils/facts/test_timeout.py
index bd18655f29..36adbfabd1 100644
--- a/test/units/module_utils/facts/test_timeout.py
+++ b/test/units/module_utils/facts/test_timeout.py
@@ -24,8 +24,8 @@ import time
import pytest
-from ansible.compat.tests import unittest
-from ansible.compat.tests.mock import patch, MagicMock
+from units.compat import unittest
+from units.compat.mock import patch, MagicMock
from ansible.module_utils.facts import timeout
diff --git a/test/units/module_utils/facts/test_utils.py b/test/units/module_utils/facts/test_utils.py
index b35f68d2fc..25a9aac7f4 100644
--- a/test/units/module_utils/facts/test_utils.py
+++ b/test/units/module_utils/facts/test_utils.py
@@ -17,8 +17,8 @@
from __future__ import (absolute_import, division)
__metaclass__ = type
-from ansible.compat.tests import unittest
-from ansible.compat.tests.mock import patch
+from units.compat import unittest
+from units.compat.mock import patch
from ansible.module_utils.facts import utils
diff --git a/test/units/module_utils/gcp/test_auth.py b/test/units/module_utils/gcp/test_auth.py
index aad732741d..b158d81ca3 100644
--- a/test/units/module_utils/gcp/test_auth.py
+++ b/test/units/module_utils/gcp/test_auth.py
@@ -20,7 +20,7 @@ import sys
import pytest
-from ansible.compat.tests import mock, unittest
+from units.compat import mock, unittest
from ansible.module_utils.gcp import (_get_gcp_ansible_credentials, _get_gcp_credentials, _get_gcp_environ_var,
_get_gcp_environment_credentials,
_validate_credentials_file)
diff --git a/test/units/module_utils/gcp/test_gcp_utils.py b/test/units/module_utils/gcp/test_gcp_utils.py
index c6c6958f85..7554100320 100644
--- a/test/units/module_utils/gcp/test_gcp_utils.py
+++ b/test/units/module_utils/gcp/test_gcp_utils.py
@@ -18,7 +18,7 @@
import os
import sys
-from ansible.compat.tests import mock, unittest
+from units.compat import mock, unittest
from ansible.module_utils.gcp_utils import GcpRequest
diff --git a/test/units/module_utils/gcp/test_utils.py b/test/units/module_utils/gcp/test_utils.py
index e2b0feb612..46cb39d02f 100644
--- a/test/units/module_utils/gcp/test_utils.py
+++ b/test/units/module_utils/gcp/test_utils.py
@@ -18,7 +18,7 @@
import os
import sys
-from ansible.compat.tests import mock, unittest
+from units.compat import mock, unittest
from ansible.module_utils.gcp import check_min_pkg_version, GCPUtils, GCPInvalidURLError
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 0166213f43..9d6e3657e7 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
@@ -22,7 +22,7 @@ __metaclass__ = type
import json
-from ansible.compat.tests import unittest
+from units.compat import unittest
from ansible.module_utils.json_utils import _filter_non_json_lines
diff --git a/test/units/module_utils/net_tools/nios/test_api.py b/test/units/module_utils/net_tools/nios/test_api.py
index a04a1f1aa6..dbac44a079 100644
--- a/test/units/module_utils/net_tools/nios/test_api.py
+++ b/test/units/module_utils/net_tools/nios/test_api.py
@@ -7,8 +7,8 @@ __metaclass__ = type
import sys
import copy
-from ansible.compat.tests import unittest
-from ansible.compat.tests.mock import patch, MagicMock, Mock
+from units.compat import unittest
+from units.compat.mock import patch, MagicMock, Mock
from ansible.module_utils.net_tools.nios import api
diff --git a/test/units/module_utils/network/aci/test_aci.py b/test/units/module_utils/network/aci/test_aci.py
index f930d75dc0..f4379ff896 100644
--- a/test/units/module_utils/network/aci/test_aci.py
+++ b/test/units/module_utils/network/aci/test_aci.py
@@ -20,7 +20,7 @@
import sys
-from ansible.compat.tests import unittest
+from units.compat import unittest
from ansible.module_utils.network.aci.aci import ACIModule
from ansible.module_utils.six import PY2, PY3
from ansible.module_utils._text import to_native
diff --git a/test/units/module_utils/network/common/test_parsing.py b/test/units/module_utils/network/common/test_parsing.py
index 7dcbea51f7..34dd0db30b 100644
--- a/test/units/module_utils/network/common/test_parsing.py
+++ b/test/units/module_utils/network/common/test_parsing.py
@@ -20,7 +20,7 @@
from __future__ import absolute_import, division, print_function
__metaclass__ = type
-from ansible.compat.tests import unittest
+from units.compat import unittest
from ansible.module_utils.network.common.parsing import Conditional
test_results = ['result_1', 'result_2', 'result_3']
diff --git a/test/units/module_utils/network/ftd/test_configuration.py b/test/units/module_utils/network/ftd/test_configuration.py
index ff6f475e23..9a58afd09e 100644
--- a/test/units/module_utils/network/ftd/test_configuration.py
+++ b/test/units/module_utils/network/ftd/test_configuration.py
@@ -16,8 +16,8 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
#
-from ansible.compat.tests import mock
-from ansible.compat.tests.mock import call, patch
+from units.compat import mock
+from units.compat.mock import call, patch
from ansible.module_utils.network.ftd.configuration import iterate_over_pageable_resource, BaseConfigurationResource
diff --git a/test/units/module_utils/network/nos/test_nos.py b/test/units/module_utils/network/nos/test_nos.py
index 8210a47728..f1bff7684f 100644
--- a/test/units/module_utils/network/nos/test_nos.py
+++ b/test/units/module_utils/network/nos/test_nos.py
@@ -24,7 +24,7 @@ import json
from mock import MagicMock, patch, call
-from ansible.compat.tests import unittest
+from units.compat import unittest
from ansible.module_utils.network.nos import nos
diff --git a/test/units/module_utils/network/nso/test_nso.py b/test/units/module_utils/network/nso/test_nso.py
index 8df776b3c9..567af586a5 100644
--- a/test/units/module_utils/network/nso/test_nso.py
+++ b/test/units/module_utils/network/nso/test_nso.py
@@ -20,8 +20,8 @@ from __future__ import (absolute_import, division, print_function)
import json
-from ansible.compat.tests.mock import patch
-from ansible.compat.tests import unittest
+from units.compat.mock import patch
+from units.compat import unittest
from ansible.module_utils.network.nso import nso
diff --git a/test/units/module_utils/network/slxos/test_slxos.py b/test/units/module_utils/network/slxos/test_slxos.py
index b2d856e7b4..ab00a415b5 100644
--- a/test/units/module_utils/network/slxos/test_slxos.py
+++ b/test/units/module_utils/network/slxos/test_slxos.py
@@ -24,7 +24,7 @@ import json
from mock import MagicMock, patch, call
-from ansible.compat.tests import unittest
+from units.compat import unittest
from ansible.module_utils.network.slxos import slxos
diff --git a/test/units/module_utils/test_postgresql.py b/test/units/module_utils/test_postgresql.py
index 7823cf92ab..cf82cbc901 100644
--- a/test/units/module_utils/test_postgresql.py
+++ b/test/units/module_utils/test_postgresql.py
@@ -3,8 +3,8 @@
import sys
-from ansible.compat.tests import unittest
-from ansible.compat.tests.mock import patch, MagicMock
+from units.compat import unittest
+from units.compat.mock import patch, MagicMock
from ansible.module_utils.six.moves import builtins
from ansible.module_utils._text import to_native