From 9f87989e7ff629e53f0324d60f404ae2c3f77ac4 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sun, 12 Feb 2023 21:05:08 +0100 Subject: [PATCH] Remove unnecessary test imports (#5978) Remove unnecessary test imports. --- .../targets/module_helper/library/mdepfail.py | 2 +- .../module_helper/library/msimpleda.py | 5 +-- tests/sanity/extra/aliases.py | 1 - tests/sanity/extra/botmeta.py | 3 +- tests/unit/compat/builtins.py | 2 +- tests/unit/compat/mock.py | 4 +-- tests/unit/compat/unittest.py | 4 +-- tests/unit/plugins/become/helper.py | 1 - tests/unit/plugins/cache/test_redis.py | 1 - .../plugins/callback/test_loganalytics.py | 2 +- .../plugins/callback/test_opentelemetry.py | 2 +- tests/unit/plugins/callback/test_splunk.py | 2 +- tests/unit/plugins/connection/test_lxc.py | 1 - tests/unit/plugins/filter/test_crc32.py | 1 - tests/unit/plugins/inventory/test_cobbler.py | 2 -- tests/unit/plugins/inventory/test_linode.py | 2 +- tests/unit/plugins/inventory/test_lxd.py | 2 -- .../plugins/inventory/test_xen_orchestra.py | 1 - tests/unit/plugins/lookup/test_bitwarden.py | 4 +-- tests/unit/plugins/lookup/test_etcd3.py | 2 -- tests/unit/plugins/lookup/test_lastpass.py | 2 +- tests/unit/plugins/lookup/test_manifold.py | 2 +- .../module_utils/cloud/test_scaleway.py | 2 -- .../module_utils/test_module_helper.py | 6 ++-- .../plugins/module_utils/test_opennebula.py | 1 - tests/unit/plugins/modules/hpe_test_utils.py | 1 - .../plugins/modules/oneview_module_loader.py | 32 +++++++++++-------- tests/unit/plugins/modules/rhn_conftest.py | 1 - .../plugins/modules/test_alerta_customer.py | 2 +- tests/unit/plugins/modules/test_discord.py | 2 +- .../unit/plugins/modules/test_github_repo.py | 1 - .../modules/test_gitlab_protected_branch.py | 2 +- .../modules/test_keycloak_authentication.py | 4 +-- .../plugins/modules/test_keycloak_client.py | 5 ++- .../test_keycloak_client_rolemapping.py | 4 +-- .../modules/test_keycloak_clientscope.py | 5 ++- .../test_keycloak_identity_provider.py | 4 +-- .../plugins/modules/test_keycloak_realm.py | 4 +-- .../modules/test_keycloak_realm_info.py | 2 +- .../plugins/modules/test_keycloak_role.py | 4 +-- .../modules/test_keycloak_user_federation.py | 4 +-- tests/unit/plugins/modules/test_linode.py | 2 +- tests/unit/plugins/modules/test_linode_v4.py | 2 +- tests/unit/plugins/modules/test_lxca_nodes.py | 2 -- tests/unit/plugins/modules/test_macports.py | 1 - tests/unit/plugins/modules/test_npm.py | 3 +- .../plugins/modules/test_ocapi_command.py | 2 +- tests/unit/plugins/modules/test_one_vm.py | 2 -- .../modules/test_oneview_datacenter_info.py | 2 +- .../modules/test_oneview_enclosure_info.py | 1 - .../modules/test_oneview_ethernet_network.py | 1 - .../test_oneview_ethernet_network_info.py | 1 - .../modules/test_oneview_fc_network.py | 1 - .../modules/test_oneview_fc_network_info.py | 1 - .../modules/test_oneview_fcoe_network.py | 1 - .../modules/test_oneview_fcoe_network_info.py | 1 - ...test_oneview_logical_interconnect_group.py | 1 - ...oneview_logical_interconnect_group_info.py | 1 - .../modules/test_oneview_network_set.py | 1 - .../modules/test_oneview_network_set_info.py | 1 - .../modules/test_oneview_san_manager.py | 1 - .../modules/test_oneview_san_manager_info.py | 1 - tests/unit/plugins/modules/test_pacman.py | 6 +--- .../modules/test_proxmox_tasks_info.py | 7 +--- .../plugins/modules/test_redis_data_incr.py | 2 +- .../unit/plugins/modules/test_rhn_channel.py | 2 +- .../unit/plugins/modules/test_rhn_register.py | 2 +- tests/unit/plugins/modules/test_statsd.py | 2 -- .../modules/test_xcc_redfish_command.py | 3 -- .../modules/test_xenserver_guest_info.py | 2 +- .../test_xenserver_guest_powerstate.py | 2 +- 71 files changed, 70 insertions(+), 121 deletions(-) diff --git a/tests/integration/targets/module_helper/library/mdepfail.py b/tests/integration/targets/module_helper/library/mdepfail.py index d48727980a..92ebbde6e8 100644 --- a/tests/integration/targets/module_helper/library/mdepfail.py +++ b/tests/integration/targets/module_helper/library/mdepfail.py @@ -34,7 +34,7 @@ from ansible_collections.community.general.plugins.module_utils.module_helper im from ansible.module_utils.basic import missing_required_lib with ModuleHelper.dependency("nopackagewiththisname", missing_required_lib("nopackagewiththisname")): - import nopackagewiththisname + import nopackagewiththisname # noqa: F401, pylint: disable=unused-import class MSimple(ModuleHelper): diff --git a/tests/integration/targets/module_helper/library/msimpleda.py b/tests/integration/targets/module_helper/library/msimpleda.py index 74ec4ba010..c21c3d2ea4 100644 --- a/tests/integration/targets/module_helper/library/msimpleda.py +++ b/tests/integration/targets/module_helper/library/msimpleda.py @@ -6,7 +6,6 @@ # SPDX-License-Identifier: GPL-3.0-or-later from __future__ import absolute_import, division, print_function -import collections __metaclass__ = type DOCUMENTATION = ''' @@ -26,7 +25,9 @@ EXAMPLES = "" RETURN = "" from ansible_collections.community.general.plugins.module_utils.module_helper import ModuleHelper -from ansible_collections.community.general.plugins.module_utils.mh.mixins.deprecate_attrs import DeprecateAttrsMixin +from ansible_collections.community.general.plugins.module_utils.mh.mixins.deprecate_attrs import ( # noqa: F401, pylint: disable=unused-import + DeprecateAttrsMixin +) class MSimpleDA(ModuleHelper): diff --git a/tests/sanity/extra/aliases.py b/tests/sanity/extra/aliases.py index 8779fec513..c1dcba0df5 100755 --- a/tests/sanity/extra/aliases.py +++ b/tests/sanity/extra/aliases.py @@ -6,7 +6,6 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os import sys import yaml diff --git a/tests/sanity/extra/botmeta.py b/tests/sanity/extra/botmeta.py index c6d677ae5e..3b6c348344 100755 --- a/tests/sanity/extra/botmeta.py +++ b/tests/sanity/extra/botmeta.py @@ -13,8 +13,7 @@ import sys import yaml -from voluptuous import All, Any, MultipleInvalid, PREVENT_EXTRA -from voluptuous import Required, Schema, Invalid +from voluptuous import Any, MultipleInvalid, PREVENT_EXTRA, Schema from voluptuous.humanize import humanize_error diff --git a/tests/unit/compat/builtins.py b/tests/unit/compat/builtins.py index b0cc618676..d548601d46 100644 --- a/tests/unit/compat/builtins.py +++ b/tests/unit/compat/builtins.py @@ -13,7 +13,7 @@ __metaclass__ = type # One unittest needs to import builtins via __import__() so we need to have # the string that represents it try: - import __builtin__ + import __builtin__ # noqa: F401, pylint: disable=unused-import except ImportError: BUILTINS = 'builtins' else: diff --git a/tests/unit/compat/mock.py b/tests/unit/compat/mock.py index f8f565dcf3..bdbea945e6 100644 --- a/tests/unit/compat/mock.py +++ b/tests/unit/compat/mock.py @@ -20,12 +20,12 @@ 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 * + from unittest.mock import * # noqa: F401, pylint: disable=unused-import except ImportError: # Python 2 # pylint: disable=wildcard-import,unused-wildcard-import try: - from mock import * + from mock import * # noqa: F401, pylint: disable=unused-import except ImportError: print('You need the mock library installed on python2.x to run tests') diff --git a/tests/unit/compat/unittest.py b/tests/unit/compat/unittest.py index 1872e58337..d50bab86f0 100644 --- a/tests/unit/compat/unittest.py +++ b/tests/unit/compat/unittest.py @@ -18,8 +18,8 @@ import sys if sys.version_info < (2, 7): try: # Need unittest2 on python2.6 - from unittest2 import * + from unittest2 import * # noqa: F401, pylint: disable=unused-import except ImportError: print('You need unittest2 installed on python2.6.x to run tests') else: - from unittest import * + from unittest import * # noqa: F401, pylint: disable=unused-import diff --git a/tests/unit/plugins/become/helper.py b/tests/unit/plugins/become/helper.py index 410738504b..9949e1befb 100644 --- a/tests/unit/plugins/become/helper.py +++ b/tests/unit/plugins/become/helper.py @@ -8,7 +8,6 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -from ansible.errors import AnsibleError from ansible.plugins.loader import become_loader, get_shell_plugin diff --git a/tests/unit/plugins/cache/test_redis.py b/tests/unit/plugins/cache/test_redis.py index 26f97c127e..81ae9293e3 100644 --- a/tests/unit/plugins/cache/test_redis.py +++ b/tests/unit/plugins/cache/test_redis.py @@ -10,7 +10,6 @@ import pytest pytest.importorskip('redis') -from ansible import constants as C from ansible.plugins.loader import cache_loader from ansible_collections.community.general.plugins.cache.redis import CacheModule as RedisCache diff --git a/tests/unit/plugins/callback/test_loganalytics.py b/tests/unit/plugins/callback/test_loganalytics.py index a61ad32d3a..f9fef3c5d6 100644 --- a/tests/unit/plugins/callback/test_loganalytics.py +++ b/tests/unit/plugins/callback/test_loganalytics.py @@ -7,7 +7,7 @@ __metaclass__ = type from ansible.executor.task_result import TaskResult from ansible_collections.community.general.tests.unit.compat import unittest -from ansible_collections.community.general.tests.unit.compat.mock import patch, call, MagicMock, Mock +from ansible_collections.community.general.tests.unit.compat.mock import patch, Mock from ansible_collections.community.general.plugins.callback.loganalytics import AzureLogAnalyticsSource from datetime import datetime diff --git a/tests/unit/plugins/callback/test_opentelemetry.py b/tests/unit/plugins/callback/test_opentelemetry.py index c6532bc2e5..dea2e29d41 100644 --- a/tests/unit/plugins/callback/test_opentelemetry.py +++ b/tests/unit/plugins/callback/test_opentelemetry.py @@ -10,7 +10,7 @@ from ansible.playbook.task import Task from ansible.executor.task_result import TaskResult from ansible_collections.community.general.tests.unit.compat import unittest from ansible_collections.community.general.tests.unit.compat.mock import patch, MagicMock, Mock -from ansible_collections.community.general.plugins.callback.opentelemetry import OpenTelemetrySource, TaskData, CallbackModule +from ansible_collections.community.general.plugins.callback.opentelemetry import OpenTelemetrySource, TaskData from collections import OrderedDict import sys diff --git a/tests/unit/plugins/callback/test_splunk.py b/tests/unit/plugins/callback/test_splunk.py index 595d1530b6..ddcdae24c7 100644 --- a/tests/unit/plugins/callback/test_splunk.py +++ b/tests/unit/plugins/callback/test_splunk.py @@ -7,7 +7,7 @@ __metaclass__ = type from ansible.executor.task_result import TaskResult from ansible_collections.community.general.tests.unit.compat import unittest -from ansible_collections.community.general.tests.unit.compat.mock import patch, call, MagicMock, Mock +from ansible_collections.community.general.tests.unit.compat.mock import patch, Mock from ansible_collections.community.general.plugins.callback.splunk import SplunkHTTPCollectorSource from datetime import datetime diff --git a/tests/unit/plugins/connection/test_lxc.py b/tests/unit/plugins/connection/test_lxc.py index 4a1139d6e9..8733a92e09 100644 --- a/tests/unit/plugins/connection/test_lxc.py +++ b/tests/unit/plugins/connection/test_lxc.py @@ -7,7 +7,6 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type from io import StringIO -import pytest from ansible_collections.community.general.tests.unit.compat import unittest from ansible_collections.community.general.plugins.connection import lxc diff --git a/tests/unit/plugins/filter/test_crc32.py b/tests/unit/plugins/filter/test_crc32.py index 961840235d..8201045136 100644 --- a/tests/unit/plugins/filter/test_crc32.py +++ b/tests/unit/plugins/filter/test_crc32.py @@ -7,7 +7,6 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible_collections.community.general.tests.unit.compat import unittest -from ansible.errors import AnsibleError from ansible_collections.community.general.plugins.filter.crc32 import crc32s diff --git a/tests/unit/plugins/inventory/test_cobbler.py b/tests/unit/plugins/inventory/test_cobbler.py index 6db9b91cbc..a09001ad62 100644 --- a/tests/unit/plugins/inventory/test_cobbler.py +++ b/tests/unit/plugins/inventory/test_cobbler.py @@ -7,9 +7,7 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type import pytest -import sys -from ansible.errors import AnsibleError, AnsibleParserError from ansible_collections.community.general.plugins.inventory.cobbler import InventoryModule diff --git a/tests/unit/plugins/inventory/test_linode.py b/tests/unit/plugins/inventory/test_linode.py index 4e6a018850..a4f556761d 100644 --- a/tests/unit/plugins/inventory/test_linode.py +++ b/tests/unit/plugins/inventory/test_linode.py @@ -16,7 +16,7 @@ mandatory_py_version = pytest.mark.skipif( ) -from ansible.errors import AnsibleError, AnsibleParserError +from ansible.errors import AnsibleError from ansible.parsing.dataloader import DataLoader from ansible.template import Templar from ansible_collections.community.general.plugins.inventory.linode import InventoryModule diff --git a/tests/unit/plugins/inventory/test_lxd.py b/tests/unit/plugins/inventory/test_lxd.py index 99c9e166c1..a1f31fdc58 100644 --- a/tests/unit/plugins/inventory/test_lxd.py +++ b/tests/unit/plugins/inventory/test_lxd.py @@ -8,9 +8,7 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type import pytest -import os -from ansible.errors import AnsibleError from ansible.inventory.data import InventoryData from ansible_collections.community.general.plugins.inventory.lxd import InventoryModule diff --git a/tests/unit/plugins/inventory/test_xen_orchestra.py b/tests/unit/plugins/inventory/test_xen_orchestra.py index 7d51f6f183..bae038e807 100644 --- a/tests/unit/plugins/inventory/test_xen_orchestra.py +++ b/tests/unit/plugins/inventory/test_xen_orchestra.py @@ -10,7 +10,6 @@ __metaclass__ = type import pytest -from ansible.errors import AnsibleError, AnsibleParserError from ansible.inventory.data import InventoryData from ansible_collections.community.general.plugins.inventory.xen_orchestra import InventoryModule diff --git a/tests/unit/plugins/lookup/test_bitwarden.py b/tests/unit/plugins/lookup/test_bitwarden.py index ac0242737e..d452639658 100644 --- a/tests/unit/plugins/lookup/test_bitwarden.py +++ b/tests/unit/plugins/lookup/test_bitwarden.py @@ -6,15 +6,13 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -from argparse import ArgumentParser - from ansible_collections.community.general.tests.unit.compat import unittest from ansible_collections.community.general.tests.unit.compat.mock import patch from ansible.errors import AnsibleError from ansible.module_utils import six from ansible.plugins.loader import lookup_loader -from ansible_collections.community.general.plugins.lookup.bitwarden import LookupModule, Bitwarden, BitwardenException +from ansible_collections.community.general.plugins.lookup.bitwarden import Bitwarden MOCK_RECORDS = [ diff --git a/tests/unit/plugins/lookup/test_etcd3.py b/tests/unit/plugins/lookup/test_etcd3.py index 798d537ed9..e9ac777ebe 100644 --- a/tests/unit/plugins/lookup/test_etcd3.py +++ b/tests/unit/plugins/lookup/test_etcd3.py @@ -8,10 +8,8 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import pytest from ansible_collections.community.general.tests.unit.compat import unittest from ansible_collections.community.general.tests.unit.compat.mock import patch, MagicMock -from ansible.errors import AnsibleError from ansible_collections.community.general.plugins.lookup import etcd3 from ansible.plugins.loader import lookup_loader diff --git a/tests/unit/plugins/lookup/test_lastpass.py b/tests/unit/plugins/lookup/test_lastpass.py index f9749716d7..5f65c9f633 100644 --- a/tests/unit/plugins/lookup/test_lastpass.py +++ b/tests/unit/plugins/lookup/test_lastpass.py @@ -14,7 +14,7 @@ from ansible_collections.community.general.tests.unit.compat.mock import patch from ansible.errors import AnsibleError from ansible.module_utils import six from ansible.plugins.loader import lookup_loader -from ansible_collections.community.general.plugins.lookup.lastpass import LookupModule, LPass, LPassException +from ansible_collections.community.general.plugins.lookup.lastpass import LPass, LPassException MOCK_ENTRIES = [{'username': 'user', diff --git a/tests/unit/plugins/lookup/test_manifold.py b/tests/unit/plugins/lookup/test_manifold.py index f6f4a605a6..4fa3562763 100644 --- a/tests/unit/plugins/lookup/test_manifold.py +++ b/tests/unit/plugins/lookup/test_manifold.py @@ -12,7 +12,7 @@ from ansible.module_utils.urls import ConnectionError, SSLValidationError from ansible.module_utils.six.moves.urllib.error import HTTPError, URLError from ansible.module_utils import six from ansible.plugins.loader import lookup_loader -from ansible_collections.community.general.plugins.lookup.manifold import ManifoldApiClient, LookupModule, ApiError +from ansible_collections.community.general.plugins.lookup.manifold import ManifoldApiClient, ApiError import json import os diff --git a/tests/unit/plugins/module_utils/cloud/test_scaleway.py b/tests/unit/plugins/module_utils/cloud/test_scaleway.py index 3dbd7fbbbc..dc53bc1261 100644 --- a/tests/unit/plugins/module_utils/cloud/test_scaleway.py +++ b/tests/unit/plugins/module_utils/cloud/test_scaleway.py @@ -5,8 +5,6 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import random - from ansible_collections.community.general.tests.unit.compat import unittest from ansible_collections.community.general.plugins.module_utils.scaleway import SecretVariables, argon2 diff --git a/tests/unit/plugins/module_utils/test_module_helper.py b/tests/unit/plugins/module_utils/test_module_helper.py index 18251cf2e9..3d8a4b654c 100644 --- a/tests/unit/plugins/module_utils/test_module_helper.py +++ b/tests/unit/plugins/module_utils/test_module_helper.py @@ -95,14 +95,14 @@ def test_arg_format_fail(fmt, style, stars, value, expected): def test_dependency_ctxmgr(): ctx = DependencyCtxMgr("POTATOES", "Potatoes must be installed") with ctx: - import potatoes_that_will_never_be_there + import potatoes_that_will_never_be_there # noqa: F401, pylint: disable=unused-import print("POTATOES: ctx.text={0}".format(ctx.text)) assert ctx.text == "Potatoes must be installed" assert not ctx.has_it ctx = DependencyCtxMgr("POTATOES2") with ctx: - import potatoes_that_will_never_be_there_again + import potatoes_that_will_never_be_there_again # noqa: F401, pylint: disable=unused-import assert not ctx.has_it print("POTATOES2: ctx.text={0}".format(ctx.text)) assert ctx.text.startswith("No module named") @@ -110,7 +110,7 @@ def test_dependency_ctxmgr(): ctx = DependencyCtxMgr("TYPING") with ctx: - import sys + import sys # noqa: F401, pylint: disable=unused-import assert ctx.has_it diff --git a/tests/unit/plugins/module_utils/test_opennebula.py b/tests/unit/plugins/module_utils/test_opennebula.py index 3dd2e91876..550d403711 100644 --- a/tests/unit/plugins/module_utils/test_opennebula.py +++ b/tests/unit/plugins/module_utils/test_opennebula.py @@ -6,7 +6,6 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os import textwrap import pytest diff --git a/tests/unit/plugins/modules/hpe_test_utils.py b/tests/unit/plugins/modules/hpe_test_utils.py index 56b4d11045..ab16d8f22b 100644 --- a/tests/unit/plugins/modules/hpe_test_utils.py +++ b/tests/unit/plugins/modules/hpe_test_utils.py @@ -13,7 +13,6 @@ import yaml from mock import Mock, patch from .oneview_module_loader import ONEVIEW_MODULE_UTILS_PATH -from .oneview_conftest import mock_ov_client, mock_ansible_module from hpOneView.oneview_client import OneViewClient diff --git a/tests/unit/plugins/modules/oneview_module_loader.py b/tests/unit/plugins/modules/oneview_module_loader.py index 51dcee788b..ae62d9ced1 100644 --- a/tests/unit/plugins/modules/oneview_module_loader.py +++ b/tests/unit/plugins/modules/oneview_module_loader.py @@ -15,18 +15,22 @@ if 'hpOneView' not in sys.modules: sys.modules['hpOneView.oneview_client'] = Mock() ONEVIEW_MODULE_UTILS_PATH = 'ansible_collections.community.general.plugins.module_utils.oneview' -from ansible_collections.community.general.plugins.module_utils.oneview import (OneViewModuleException, - OneViewModuleTaskError, - OneViewModuleResourceNotFound, - OneViewModuleBase) +from ansible_collections.community.general.plugins.module_utils.oneview import ( # noqa: F401, pylint: disable=unused-import + OneViewModuleException, + OneViewModuleTaskError, + OneViewModuleResourceNotFound, + OneViewModuleBase, +) -from ansible_collections.community.general.plugins.modules.oneview_ethernet_network import EthernetNetworkModule -from ansible_collections.community.general.plugins.modules.oneview_ethernet_network_info import EthernetNetworkInfoModule -from ansible_collections.community.general.plugins.modules.oneview_fc_network import FcNetworkModule -from ansible_collections.community.general.plugins.modules.oneview_fc_network_info import FcNetworkInfoModule -from ansible_collections.community.general.plugins.modules.oneview_fcoe_network import FcoeNetworkModule -from ansible_collections.community.general.plugins.modules.oneview_fcoe_network_info import FcoeNetworkInfoModule -from ansible_collections.community.general.plugins.modules.oneview_network_set import NetworkSetModule -from ansible_collections.community.general.plugins.modules.oneview_network_set_info import NetworkSetInfoModule -from ansible_collections.community.general.plugins.modules.oneview_san_manager import SanManagerModule -from ansible_collections.community.general.plugins.modules.oneview_san_manager_info import SanManagerInfoModule +from ansible_collections.community.general.plugins.modules.oneview_ethernet_network import EthernetNetworkModule # noqa: F401, pylint: disable=unused-import +from ansible_collections.community.general.plugins.modules.oneview_ethernet_network_info import ( # noqa: F401, pylint: disable=unused-import + EthernetNetworkInfoModule, +) +from ansible_collections.community.general.plugins.modules.oneview_fc_network import FcNetworkModule # noqa: F401, pylint: disable=unused-import +from ansible_collections.community.general.plugins.modules.oneview_fc_network_info import FcNetworkInfoModule # noqa: F401, pylint: disable=unused-import +from ansible_collections.community.general.plugins.modules.oneview_fcoe_network import FcoeNetworkModule # noqa: F401, pylint: disable=unused-import +from ansible_collections.community.general.plugins.modules.oneview_fcoe_network_info import FcoeNetworkInfoModule # noqa: F401, pylint: disable=unused-import +from ansible_collections.community.general.plugins.modules.oneview_network_set import NetworkSetModule # noqa: F401, pylint: disable=unused-import +from ansible_collections.community.general.plugins.modules.oneview_network_set_info import NetworkSetInfoModule # noqa: F401, pylint: disable=unused-import +from ansible_collections.community.general.plugins.modules.oneview_san_manager import SanManagerModule # noqa: F401, pylint: disable=unused-import +from ansible_collections.community.general.plugins.modules.oneview_san_manager_info import SanManagerInfoModule # noqa: F401, pylint: disable=unused-import diff --git a/tests/unit/plugins/modules/rhn_conftest.py b/tests/unit/plugins/modules/rhn_conftest.py index a8f890050e..acc0e2f221 100644 --- a/tests/unit/plugins/modules/rhn_conftest.py +++ b/tests/unit/plugins/modules/rhn_conftest.py @@ -5,7 +5,6 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -from ansible_collections.community.general.tests.unit.compat.mock import patch from ansible.module_utils.six.moves import xmlrpc_client import pytest diff --git a/tests/unit/plugins/modules/test_alerta_customer.py b/tests/unit/plugins/modules/test_alerta_customer.py index 2b63464e09..ccd0ced50e 100644 --- a/tests/unit/plugins/modules/test_alerta_customer.py +++ b/tests/unit/plugins/modules/test_alerta_customer.py @@ -7,7 +7,7 @@ __metaclass__ = type import json import pytest -from ansible_collections.community.general.tests.unit.compat.mock import Mock, patch +from ansible_collections.community.general.tests.unit.compat.mock import patch from ansible_collections.community.general.plugins.modules import alerta_customer from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args diff --git a/tests/unit/plugins/modules/test_discord.py b/tests/unit/plugins/modules/test_discord.py index 007cd0038e..83069d279d 100644 --- a/tests/unit/plugins/modules/test_discord.py +++ b/tests/unit/plugins/modules/test_discord.py @@ -7,7 +7,7 @@ __metaclass__ = type import json import pytest -from ansible_collections.community.general.tests.unit.compat.mock import Mock, patch +from ansible_collections.community.general.tests.unit.compat.mock import patch from ansible_collections.community.general.plugins.modules import discord from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args diff --git a/tests/unit/plugins/modules/test_github_repo.py b/tests/unit/plugins/modules/test_github_repo.py index e86179f874..10227aadfb 100644 --- a/tests/unit/plugins/modules/test_github_repo.py +++ b/tests/unit/plugins/modules/test_github_repo.py @@ -5,7 +5,6 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import requests import re import json import sys diff --git a/tests/unit/plugins/modules/test_gitlab_protected_branch.py b/tests/unit/plugins/modules/test_gitlab_protected_branch.py index de35a4b28b..1162d8a351 100644 --- a/tests/unit/plugins/modules/test_gitlab_protected_branch.py +++ b/tests/unit/plugins/modules/test_gitlab_protected_branch.py @@ -31,7 +31,7 @@ try: # GitLab module requirements if python_version_match_requirement(): - from gitlab.v4.objects import Project + from gitlab.v4.objects import Project # noqa: F401, pylint: disable=unused-import gitlab_req_version = python_gitlab_version_match_requirement() gitlab_module_version = python_gitlab_module_version() if LooseVersion(gitlab_module_version) < LooseVersion(gitlab_req_version): diff --git a/tests/unit/plugins/modules/test_keycloak_authentication.py b/tests/unit/plugins/modules/test_keycloak_authentication.py index 19bea8ac0e..aaa1fa9b1b 100644 --- a/tests/unit/plugins/modules/test_keycloak_authentication.py +++ b/tests/unit/plugins/modules/test_keycloak_authentication.py @@ -10,8 +10,8 @@ __metaclass__ = type from contextlib import contextmanager from ansible_collections.community.general.tests.unit.compat import unittest -from ansible_collections.community.general.tests.unit.compat.mock import call, patch -from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args +from ansible_collections.community.general.tests.unit.compat.mock import patch +from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, ModuleTestCase, set_module_args from ansible_collections.community.general.plugins.modules import keycloak_authentication diff --git a/tests/unit/plugins/modules/test_keycloak_client.py b/tests/unit/plugins/modules/test_keycloak_client.py index bc71b37327..b44013af13 100644 --- a/tests/unit/plugins/modules/test_keycloak_client.py +++ b/tests/unit/plugins/modules/test_keycloak_client.py @@ -11,9 +11,8 @@ __metaclass__ = type from contextlib import contextmanager from ansible_collections.community.general.tests.unit.compat import unittest -from ansible_collections.community.general.tests.unit.compat.mock import call, patch -from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, AnsibleFailJson, \ - ModuleTestCase, set_module_args +from ansible_collections.community.general.tests.unit.compat.mock import patch +from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, ModuleTestCase, set_module_args from ansible_collections.community.general.plugins.modules import keycloak_client diff --git a/tests/unit/plugins/modules/test_keycloak_client_rolemapping.py b/tests/unit/plugins/modules/test_keycloak_client_rolemapping.py index 648d04aa23..58c8b95483 100644 --- a/tests/unit/plugins/modules/test_keycloak_client_rolemapping.py +++ b/tests/unit/plugins/modules/test_keycloak_client_rolemapping.py @@ -10,8 +10,8 @@ __metaclass__ = type from contextlib import contextmanager from ansible_collections.community.general.tests.unit.compat import unittest -from ansible_collections.community.general.tests.unit.compat.mock import call, patch -from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args +from ansible_collections.community.general.tests.unit.compat.mock import patch +from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, ModuleTestCase, set_module_args from ansible_collections.community.general.plugins.modules import keycloak_client_rolemapping diff --git a/tests/unit/plugins/modules/test_keycloak_clientscope.py b/tests/unit/plugins/modules/test_keycloak_clientscope.py index 2d09496bbf..ea015b05bf 100644 --- a/tests/unit/plugins/modules/test_keycloak_clientscope.py +++ b/tests/unit/plugins/modules/test_keycloak_clientscope.py @@ -11,9 +11,8 @@ __metaclass__ = type from contextlib import contextmanager from ansible_collections.community.general.tests.unit.compat import unittest -from ansible_collections.community.general.tests.unit.compat.mock import call, patch -from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, AnsibleFailJson, \ - ModuleTestCase, set_module_args +from ansible_collections.community.general.tests.unit.compat.mock import patch +from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, ModuleTestCase, set_module_args from ansible_collections.community.general.plugins.modules import keycloak_clientscope diff --git a/tests/unit/plugins/modules/test_keycloak_identity_provider.py b/tests/unit/plugins/modules/test_keycloak_identity_provider.py index ecee7eb9ef..6fd258b8a3 100644 --- a/tests/unit/plugins/modules/test_keycloak_identity_provider.py +++ b/tests/unit/plugins/modules/test_keycloak_identity_provider.py @@ -10,8 +10,8 @@ __metaclass__ = type from contextlib import contextmanager from ansible_collections.community.general.tests.unit.compat import unittest -from ansible_collections.community.general.tests.unit.compat.mock import call, patch -from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args +from ansible_collections.community.general.tests.unit.compat.mock import patch +from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, ModuleTestCase, set_module_args from ansible_collections.community.general.plugins.modules import keycloak_identity_provider diff --git a/tests/unit/plugins/modules/test_keycloak_realm.py b/tests/unit/plugins/modules/test_keycloak_realm.py index 1572d79cbd..72993cbdfe 100644 --- a/tests/unit/plugins/modules/test_keycloak_realm.py +++ b/tests/unit/plugins/modules/test_keycloak_realm.py @@ -10,8 +10,8 @@ __metaclass__ = type from contextlib import contextmanager from ansible_collections.community.general.tests.unit.compat import unittest -from ansible_collections.community.general.tests.unit.compat.mock import call, patch -from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args +from ansible_collections.community.general.tests.unit.compat.mock import patch +from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, ModuleTestCase, set_module_args from ansible_collections.community.general.plugins.modules import keycloak_realm diff --git a/tests/unit/plugins/modules/test_keycloak_realm_info.py b/tests/unit/plugins/modules/test_keycloak_realm_info.py index c1860e41ff..41095a8784 100644 --- a/tests/unit/plugins/modules/test_keycloak_realm_info.py +++ b/tests/unit/plugins/modules/test_keycloak_realm_info.py @@ -10,7 +10,7 @@ __metaclass__ = type from contextlib import contextmanager from ansible_collections.community.general.tests.unit.compat import unittest -from ansible_collections.community.general.tests.unit.compat.mock import call, patch +from ansible_collections.community.general.tests.unit.compat.mock import patch from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, ModuleTestCase, set_module_args from ansible_collections.community.general.plugins.modules import keycloak_realm_info diff --git a/tests/unit/plugins/modules/test_keycloak_role.py b/tests/unit/plugins/modules/test_keycloak_role.py index 74cd7bc9a3..c48c9771a5 100644 --- a/tests/unit/plugins/modules/test_keycloak_role.py +++ b/tests/unit/plugins/modules/test_keycloak_role.py @@ -10,8 +10,8 @@ __metaclass__ = type from contextlib import contextmanager from ansible_collections.community.general.tests.unit.compat import unittest -from ansible_collections.community.general.tests.unit.compat.mock import call, patch -from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args +from ansible_collections.community.general.tests.unit.compat.mock import patch +from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, ModuleTestCase, set_module_args from ansible_collections.community.general.plugins.modules import keycloak_role diff --git a/tests/unit/plugins/modules/test_keycloak_user_federation.py b/tests/unit/plugins/modules/test_keycloak_user_federation.py index 7b624ef067..8d3dcaa230 100644 --- a/tests/unit/plugins/modules/test_keycloak_user_federation.py +++ b/tests/unit/plugins/modules/test_keycloak_user_federation.py @@ -10,8 +10,8 @@ __metaclass__ = type from contextlib import contextmanager from ansible_collections.community.general.tests.unit.compat import unittest -from ansible_collections.community.general.tests.unit.compat.mock import call, patch -from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args +from ansible_collections.community.general.tests.unit.compat.mock import patch +from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, ModuleTestCase, set_module_args from ansible_collections.community.general.plugins.modules import keycloak_user_federation diff --git a/tests/unit/plugins/modules/test_linode.py b/tests/unit/plugins/modules/test_linode.py index 684a5f0c67..9e7b158d8e 100644 --- a/tests/unit/plugins/modules/test_linode.py +++ b/tests/unit/plugins/modules/test_linode.py @@ -10,7 +10,7 @@ import pytest from ansible_collections.community.general.plugins.modules import linode from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args -from .linode_conftest import api_key, auth +from .linode_conftest import api_key, auth # noqa: F401, pylint: disable=unused-import if not linode.HAS_LINODE: pytestmark = pytest.mark.skip('test_linode.py requires the `linode-python` module') diff --git a/tests/unit/plugins/modules/test_linode_v4.py b/tests/unit/plugins/modules/test_linode_v4.py index 37774bfd44..915a82f087 100644 --- a/tests/unit/plugins/modules/test_linode_v4.py +++ b/tests/unit/plugins/modules/test_linode_v4.py @@ -25,7 +25,7 @@ from ansible_collections.community.general.plugins.module_utils.linode import ge from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args from ansible_collections.community.general.tests.unit.compat import mock -from .linode_conftest import access_token, no_access_token_in_env, default_args, mock_linode +from .linode_conftest import access_token, no_access_token_in_env, default_args, mock_linode # noqa: F401, pylint: disable=unused-import def test_mandatory_state_is_validated(capfd): diff --git a/tests/unit/plugins/modules/test_lxca_nodes.py b/tests/unit/plugins/modules/test_lxca_nodes.py index 677587f1c4..87effa0c01 100644 --- a/tests/unit/plugins/modules/test_lxca_nodes.py +++ b/tests/unit/plugins/modules/test_lxca_nodes.py @@ -10,8 +10,6 @@ import json import pytest from ansible_collections.community.general.tests.unit.compat import mock from ansible_collections.community.general.plugins.modules import lxca_nodes -from ansible_collections.community.general.plugins.module_utils.remote_management.lxca.common import setup_conn -from ansible_collections.community.general.plugins.module_utils.remote_management.lxca.common import close_conn @pytest.fixture(scope='module') diff --git a/tests/unit/plugins/modules/test_macports.py b/tests/unit/plugins/modules/test_macports.py index 8fa3942e88..61de27654e 100644 --- a/tests/unit/plugins/modules/test_macports.py +++ b/tests/unit/plugins/modules/test_macports.py @@ -5,7 +5,6 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -from ansible.module_utils import basic from ansible_collections.community.general.plugins.modules import macports import pytest diff --git a/tests/unit/plugins/modules/test_npm.py b/tests/unit/plugins/modules/test_npm.py index 6041fcb0cf..f5d3127759 100644 --- a/tests/unit/plugins/modules/test_npm.py +++ b/tests/unit/plugins/modules/test_npm.py @@ -8,8 +8,7 @@ __metaclass__ = type from ansible_collections.community.general.tests.unit.compat.mock import call, patch from ansible_collections.community.general.plugins.modules import npm -from ansible_collections.community.general.tests.unit.plugins.modules.utils import ( - AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args) +from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, ModuleTestCase, set_module_args class NPMModuleTestCase(ModuleTestCase): diff --git a/tests/unit/plugins/modules/test_ocapi_command.py b/tests/unit/plugins/modules/test_ocapi_command.py index 031fb9dd09..3ce267c4e9 100644 --- a/tests/unit/plugins/modules/test_ocapi_command.py +++ b/tests/unit/plugins/modules/test_ocapi_command.py @@ -16,7 +16,7 @@ from ansible.module_utils import basic import ansible_collections.community.general.plugins.modules.ocapi_command as module from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, AnsibleFailJson from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args, exit_json, fail_json -from ansible.module_utils.six.moves.urllib.parse import quote_plus, urljoin +from ansible.module_utils.six.moves.urllib.parse import urljoin MOCK_BASE_URI = "mockBaseUri/" diff --git a/tests/unit/plugins/modules/test_one_vm.py b/tests/unit/plugins/modules/test_one_vm.py index f89a0c63df..fcfa685af7 100644 --- a/tests/unit/plugins/modules/test_one_vm.py +++ b/tests/unit/plugins/modules/test_one_vm.py @@ -6,8 +6,6 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import os - import pytest from ansible_collections.community.general.plugins.modules.one_vm import parse_updateconf diff --git a/tests/unit/plugins/modules/test_oneview_datacenter_info.py b/tests/unit/plugins/modules/test_oneview_datacenter_info.py index 1224a8fde7..eb5e05d229 100644 --- a/tests/unit/plugins/modules/test_oneview_datacenter_info.py +++ b/tests/unit/plugins/modules/test_oneview_datacenter_info.py @@ -8,7 +8,7 @@ __metaclass__ = type import pytest from .hpe_test_utils import FactsParamsTest -from .oneview_conftest import mock_ov_client, mock_ansible_module +from .oneview_conftest import mock_ov_client, mock_ansible_module # noqa: F401, pylint: disable=unused-import from ansible_collections.community.general.plugins.modules.oneview_datacenter_info import DatacenterInfoModule diff --git a/tests/unit/plugins/modules/test_oneview_enclosure_info.py b/tests/unit/plugins/modules/test_oneview_enclosure_info.py index 4356e70e29..e8ef3449fb 100644 --- a/tests/unit/plugins/modules/test_oneview_enclosure_info.py +++ b/tests/unit/plugins/modules/test_oneview_enclosure_info.py @@ -6,7 +6,6 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type from .hpe_test_utils import FactsParamsTestCase -from .oneview_conftest import mock_ov_client, mock_ansible_module from ansible_collections.community.general.tests.unit.compat import unittest from ansible_collections.community.general.plugins.modules.oneview_enclosure_info import EnclosureInfoModule diff --git a/tests/unit/plugins/modules/test_oneview_ethernet_network.py b/tests/unit/plugins/modules/test_oneview_ethernet_network.py index 834c6c88c6..f1398740ee 100644 --- a/tests/unit/plugins/modules/test_oneview_ethernet_network.py +++ b/tests/unit/plugins/modules/test_oneview_ethernet_network.py @@ -11,7 +11,6 @@ import yaml from ansible_collections.community.general.tests.unit.compat import unittest, mock from .oneview_module_loader import EthernetNetworkModule -from .oneview_conftest import mock_ov_client, mock_ansible_module from .hpe_test_utils import OneViewBaseTestCase FAKE_MSG_ERROR = 'Fake message error' diff --git a/tests/unit/plugins/modules/test_oneview_ethernet_network_info.py b/tests/unit/plugins/modules/test_oneview_ethernet_network_info.py index f922bc8f48..4a2813e2f8 100644 --- a/tests/unit/plugins/modules/test_oneview_ethernet_network_info.py +++ b/tests/unit/plugins/modules/test_oneview_ethernet_network_info.py @@ -8,7 +8,6 @@ __metaclass__ = type from ansible_collections.community.general.tests.unit.compat import unittest from .oneview_module_loader import EthernetNetworkInfoModule -from .oneview_conftest import mock_ov_client, mock_ansible_module from .hpe_test_utils import FactsParamsTestCase ERROR_MSG = 'Fake message error' diff --git a/tests/unit/plugins/modules/test_oneview_fc_network.py b/tests/unit/plugins/modules/test_oneview_fc_network.py index 97d5ef85b6..6def80fc43 100644 --- a/tests/unit/plugins/modules/test_oneview_fc_network.py +++ b/tests/unit/plugins/modules/test_oneview_fc_network.py @@ -9,7 +9,6 @@ __metaclass__ = type from ansible_collections.community.general.tests.unit.compat import unittest from .oneview_module_loader import FcNetworkModule -from .oneview_conftest import mock_ov_client, mock_ansible_module from .hpe_test_utils import OneViewBaseTestCase FAKE_MSG_ERROR = 'Fake message error' diff --git a/tests/unit/plugins/modules/test_oneview_fc_network_info.py b/tests/unit/plugins/modules/test_oneview_fc_network_info.py index c548bf02f7..236ce136ad 100644 --- a/tests/unit/plugins/modules/test_oneview_fc_network_info.py +++ b/tests/unit/plugins/modules/test_oneview_fc_network_info.py @@ -7,7 +7,6 @@ __metaclass__ = type from ansible_collections.community.general.tests.unit.compat import unittest from .oneview_module_loader import FcNetworkInfoModule -from .oneview_conftest import mock_ov_client, mock_ansible_module from .hpe_test_utils import FactsParamsTestCase ERROR_MSG = 'Fake message error' diff --git a/tests/unit/plugins/modules/test_oneview_fcoe_network.py b/tests/unit/plugins/modules/test_oneview_fcoe_network.py index 8e74f8c73d..224e5471e9 100644 --- a/tests/unit/plugins/modules/test_oneview_fcoe_network.py +++ b/tests/unit/plugins/modules/test_oneview_fcoe_network.py @@ -9,7 +9,6 @@ __metaclass__ = type from ansible_collections.community.general.tests.unit.compat import unittest from .oneview_module_loader import FcoeNetworkModule -from .oneview_conftest import mock_ov_client, mock_ansible_module from .hpe_test_utils import OneViewBaseTestCase FAKE_MSG_ERROR = 'Fake message error' diff --git a/tests/unit/plugins/modules/test_oneview_fcoe_network_info.py b/tests/unit/plugins/modules/test_oneview_fcoe_network_info.py index a8fda975a8..387c1da3c1 100644 --- a/tests/unit/plugins/modules/test_oneview_fcoe_network_info.py +++ b/tests/unit/plugins/modules/test_oneview_fcoe_network_info.py @@ -8,7 +8,6 @@ __metaclass__ = type from ansible_collections.community.general.tests.unit.compat import unittest from .oneview_module_loader import FcoeNetworkInfoModule -from .oneview_conftest import mock_ov_client, mock_ansible_module from .hpe_test_utils import FactsParamsTestCase ERROR_MSG = 'Fake message error' diff --git a/tests/unit/plugins/modules/test_oneview_logical_interconnect_group.py b/tests/unit/plugins/modules/test_oneview_logical_interconnect_group.py index 99b4a8bc63..1f941fb50f 100644 --- a/tests/unit/plugins/modules/test_oneview_logical_interconnect_group.py +++ b/tests/unit/plugins/modules/test_oneview_logical_interconnect_group.py @@ -9,7 +9,6 @@ from copy import deepcopy from ansible_collections.community.general.tests.unit.compat import unittest, mock from .hpe_test_utils import OneViewBaseTestCase -from .oneview_conftest import mock_ov_client, mock_ansible_module from ansible_collections.community.general.plugins.modules.oneview_logical_interconnect_group import LogicalInterconnectGroupModule diff --git a/tests/unit/plugins/modules/test_oneview_logical_interconnect_group_info.py b/tests/unit/plugins/modules/test_oneview_logical_interconnect_group_info.py index 425aac6ba8..9fa602a8cf 100644 --- a/tests/unit/plugins/modules/test_oneview_logical_interconnect_group_info.py +++ b/tests/unit/plugins/modules/test_oneview_logical_interconnect_group_info.py @@ -7,7 +7,6 @@ __metaclass__ = type from ansible_collections.community.general.tests.unit.compat import unittest from .hpe_test_utils import FactsParamsTestCase -from .oneview_conftest import mock_ov_client, mock_ansible_module from ansible_collections.community.general.plugins.modules.oneview_logical_interconnect_group_info import ( LogicalInterconnectGroupInfoModule ) diff --git a/tests/unit/plugins/modules/test_oneview_network_set.py b/tests/unit/plugins/modules/test_oneview_network_set.py index be89898aed..f801cd102a 100644 --- a/tests/unit/plugins/modules/test_oneview_network_set.py +++ b/tests/unit/plugins/modules/test_oneview_network_set.py @@ -8,7 +8,6 @@ __metaclass__ = type from ansible_collections.community.general.tests.unit.compat import unittest, mock from .hpe_test_utils import OneViewBaseTestCase from .oneview_module_loader import NetworkSetModule -from .oneview_conftest import mock_ov_client, mock_ansible_module FAKE_MSG_ERROR = 'Fake message error' diff --git a/tests/unit/plugins/modules/test_oneview_network_set_info.py b/tests/unit/plugins/modules/test_oneview_network_set_info.py index 67d8f28201..13cd0400a4 100644 --- a/tests/unit/plugins/modules/test_oneview_network_set_info.py +++ b/tests/unit/plugins/modules/test_oneview_network_set_info.py @@ -7,7 +7,6 @@ __metaclass__ = type from ansible_collections.community.general.tests.unit.compat import unittest from .oneview_module_loader import NetworkSetInfoModule -from .oneview_conftest import mock_ov_client, mock_ansible_module from .hpe_test_utils import FactsParamsTestCase ERROR_MSG = 'Fake message error' diff --git a/tests/unit/plugins/modules/test_oneview_san_manager.py b/tests/unit/plugins/modules/test_oneview_san_manager.py index 22ee624f24..d675c3b353 100644 --- a/tests/unit/plugins/modules/test_oneview_san_manager.py +++ b/tests/unit/plugins/modules/test_oneview_san_manager.py @@ -7,7 +7,6 @@ __metaclass__ = type from ansible_collections.community.general.tests.unit.compat import unittest, mock from .oneview_module_loader import SanManagerModule -from .oneview_conftest import mock_ov_client, mock_ansible_module from .hpe_test_utils import OneViewBaseTestCase from copy import deepcopy diff --git a/tests/unit/plugins/modules/test_oneview_san_manager_info.py b/tests/unit/plugins/modules/test_oneview_san_manager_info.py index c786e504e0..be1f243161 100644 --- a/tests/unit/plugins/modules/test_oneview_san_manager_info.py +++ b/tests/unit/plugins/modules/test_oneview_san_manager_info.py @@ -7,7 +7,6 @@ __metaclass__ = type from ansible_collections.community.general.tests.unit.compat import unittest from .oneview_module_loader import SanManagerInfoModule -from .oneview_conftest import mock_ov_client, mock_ansible_module from .hpe_test_utils import FactsParamsTestCase diff --git a/tests/unit/plugins/modules/test_pacman.py b/tests/unit/plugins/modules/test_pacman.py index c3e455c034..04ff5bb3e8 100644 --- a/tests/unit/plugins/modules/test_pacman.py +++ b/tests/unit/plugins/modules/test_pacman.py @@ -6,12 +6,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -import sys - from ansible.module_utils import basic -from ansible_collections.community.general.tests.unit.compat import mock, unittest -from ansible_collections.community.general.tests.unit.compat.mock import patch +from ansible_collections.community.general.tests.unit.compat import mock from ansible_collections.community.general.tests.unit.plugins.modules.utils import ( AnsibleExitJson, AnsibleFailJson, @@ -27,7 +24,6 @@ from ansible_collections.community.general.plugins.modules.pacman import ( ) import pytest -import json def get_bin_path(self, arg, required=False): diff --git a/tests/unit/plugins/modules/test_proxmox_tasks_info.py b/tests/unit/plugins/modules/test_proxmox_tasks_info.py index aff3fe189a..0d1b5a7bfb 100644 --- a/tests/unit/plugins/modules/test_proxmox_tasks_info.py +++ b/tests/unit/plugins/modules/test_proxmox_tasks_info.py @@ -15,13 +15,8 @@ import json from ansible_collections.community.general.plugins.modules import proxmox_tasks_info import ansible_collections.community.general.plugins.module_utils.proxmox as proxmox_utils -from ansible_collections.community.general.plugins.module_utils.proxmox import ProxmoxAnsible -from ansible_collections.community.general.tests.unit.compat.mock import MagicMock, patch -from ansible_collections.community.general.tests.unit.plugins.modules.utils import ( - AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args -) +from ansible_collections.community.general.tests.unit.compat.mock import patch from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args -from ansible_collections.community.general.plugins.module_utils import proxmox NODE = 'node01' TASK_UPID = 'UPID:iaclab-01-01:000029DD:1599528B:6108F068:srvreload:networking:root@pam:' diff --git a/tests/unit/plugins/modules/test_redis_data_incr.py b/tests/unit/plugins/modules/test_redis_data_incr.py index 24c792adb1..d819b2f7e2 100644 --- a/tests/unit/plugins/modules/test_redis_data_incr.py +++ b/tests/unit/plugins/modules/test_redis_data_incr.py @@ -21,7 +21,7 @@ HAS_REDIS_USERNAME_OPTION = True if tuple(map(int, __version__.split('.'))) < (3, 4, 0): HAS_REDIS_USERNAME_OPTION = False if HAS_REDIS_USERNAME_OPTION: - from redis.exceptions import NoPermissionError, RedisError, ResponseError + from redis.exceptions import NoPermissionError def test_redis_data_incr_without_arguments(capfd): diff --git a/tests/unit/plugins/modules/test_rhn_channel.py b/tests/unit/plugins/modules/test_rhn_channel.py index cfbb11e118..fd3bdc5fe0 100644 --- a/tests/unit/plugins/modules/test_rhn_channel.py +++ b/tests/unit/plugins/modules/test_rhn_channel.py @@ -10,7 +10,7 @@ import json from ansible_collections.community.general.plugins.modules import rhn_channel -from .rhn_conftest import mock_request +from .rhn_conftest import mock_request # noqa: F401, pylint: disable=unused-import import pytest diff --git a/tests/unit/plugins/modules/test_rhn_register.py b/tests/unit/plugins/modules/test_rhn_register.py index 62d952a428..1394c07b65 100644 --- a/tests/unit/plugins/modules/test_rhn_register.py +++ b/tests/unit/plugins/modules/test_rhn_register.py @@ -15,7 +15,7 @@ import ansible.module_utils.six from ansible.module_utils.six.moves import xmlrpc_client from ansible_collections.community.general.plugins.modules import rhn_register -from .rhn_conftest import mock_request +from .rhn_conftest import mock_request # noqa: F401, pylint: disable=unused-import import pytest diff --git a/tests/unit/plugins/modules/test_statsd.py b/tests/unit/plugins/modules/test_statsd.py index 49aadf2b90..7d458c5eb4 100644 --- a/tests/unit/plugins/modules/test_statsd.py +++ b/tests/unit/plugins/modules/test_statsd.py @@ -5,8 +5,6 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import pytest - from ansible_collections.community.general.plugins.modules import statsd from ansible_collections.community.general.tests.unit.compat.mock import patch, MagicMock from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args diff --git a/tests/unit/plugins/modules/test_xcc_redfish_command.py b/tests/unit/plugins/modules/test_xcc_redfish_command.py index c4132125cc..c3902a2f30 100644 --- a/tests/unit/plugins/modules/test_xcc_redfish_command.py +++ b/tests/unit/plugins/modules/test_xcc_redfish_command.py @@ -5,12 +5,9 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import json -from ansible_collections.community.general.tests.unit.compat import mock from ansible_collections.community.general.tests.unit.compat.mock import patch from ansible_collections.community.general.tests.unit.compat import unittest from ansible.module_utils import basic -from ansible.module_utils.common.text.converters import to_bytes import ansible_collections.community.general.plugins.modules.xcc_redfish_command as module from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, AnsibleFailJson from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args, exit_json, fail_json diff --git a/tests/unit/plugins/modules/test_xenserver_guest_info.py b/tests/unit/plugins/modules/test_xenserver_guest_info.py index fd669953a8..6eb22a7671 100644 --- a/tests/unit/plugins/modules/test_xenserver_guest_info.py +++ b/tests/unit/plugins/modules/test_xenserver_guest_info.py @@ -12,7 +12,7 @@ import json import pytest from .xenserver_common import fake_xenapi_ref -from .xenserver_conftest import XenAPI, xenserver_guest_info +from .xenserver_conftest import XenAPI, xenserver_guest_info # noqa: F401, pylint: disable=unused-import pytestmark = pytest.mark.usefixtures('patch_ansible_module') diff --git a/tests/unit/plugins/modules/test_xenserver_guest_powerstate.py b/tests/unit/plugins/modules/test_xenserver_guest_powerstate.py index d209ca1600..74b21fcf36 100644 --- a/tests/unit/plugins/modules/test_xenserver_guest_powerstate.py +++ b/tests/unit/plugins/modules/test_xenserver_guest_powerstate.py @@ -11,7 +11,7 @@ import json import pytest from .xenserver_common import fake_xenapi_ref -from .xenserver_conftest import fake_ansible_module, XenAPI, xenserver_guest_powerstate +from .xenserver_conftest import fake_ansible_module, XenAPI, xenserver_guest_powerstate # noqa: F401, pylint: disable=unused-import testcase_set_powerstate = {