unit tests: remove unused imports (#60462)

pull/60505/head
Andrey Klychkov 5 years ago committed by Felix Fontein
parent 1b1216d2d1
commit 21863d48f3

@ -10,11 +10,6 @@ __metaclass__ = type
import os
from itertools import product
try:
import builtins
except ImportError:
import __builtin__ as builtins
import pytest

@ -19,8 +19,6 @@
from __future__ import (absolute_import, division)
__metaclass__ = type
import os
from units.compat import unittest
from units.compat.mock import Mock, patch

@ -9,7 +9,6 @@ __metaclass__ = type
import pytest
from .FakeAnsibleModule import FailJsonException
from .common import testcase_bad_xenapi_refs

@ -7,9 +7,6 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from .FakeAnsibleModule import FailJsonException
def test_xapi_to_module_vm_power_state_bad_power_state(xenserver):
"""Tests that None is returned on bad power state."""
assert xenserver.xapi_to_module_vm_power_state("bad") is None

@ -9,7 +9,6 @@ __metaclass__ = type
import pytest
from .FakeAnsibleModule import FailJsonException
from ansible.module_utils.common.network import is_mac
testcase_is_valid_mac_addr = [

@ -17,7 +17,6 @@
from units.utils.amazon_placebo_fixtures import placeboify, maybe_sleep
from ansible.modules.cloud.amazon import aws_direct_connect_connection
from ansible.module_utils.ec2 import get_aws_connection_info, boto3_conn
class FakeModule(object):

@ -16,7 +16,6 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
import pytest
from mock import patch
from units.utils.amazon_placebo_fixtures import placeboify, maybe_sleep
from ansible.modules.cloud.amazon import cloudformation as cfn_module

@ -19,7 +19,6 @@ import pytest
import os
from units.utils.amazon_placebo_fixtures import placeboify, maybe_sleep
from ansible.modules.cloud.amazon import ec2_vpc_vpn
from ansible.module_utils._text import to_text
from ansible.module_utils.ec2 import get_aws_connection_info, boto3_conn, boto3_tag_list_to_ansible_dict

@ -6,7 +6,6 @@ from units.modules.utils import set_module_args
from units.utils.kubevirt_fixtures import base_fixture, RESOURCE_DEFAULT_ARGS, AnsibleExitJson
from ansible.module_utils.k8s.raw import KubernetesRawModule
from ansible.module_utils.kubevirt import KubeVirtRawModule
from ansible.modules.cloud.kubevirt import kubevirt_rs as mymodule
KIND = 'VirtualMachineInstanceReplicaSet'

@ -7,7 +7,6 @@ import uuid
from urllib3.response import HTTPResponse
from units.compat.mock import patch
from ansible.module_utils import basic
from ansible.module_utils._text import to_bytes
from ansible.modules.monitoring import circonus_annotation
from units.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args

@ -1,8 +1,6 @@
from units.compat import unittest
from ansible.modules.monitoring import pagerduty_alert
from ansible.module_utils.six.moves.urllib.parse import urlunparse
class PagerDutyAlertsTest(unittest.TestCase):
def _assert_incident_api(self, module, url, method, headers):

@ -20,7 +20,6 @@ __metaclass__ = type
from ansible.modules.net_tools.nios import nios_host_record
from ansible.module_utils.net_tools.nios import api
from units.modules.utils import set_module_args
from units.compat.mock import patch, MagicMock, Mock
from .test_nios_module import TestNiosModule, load_fixture

@ -21,7 +21,6 @@ __metaclass__ = type
from ansible.module_utils.net_tools.nios import api
from ansible.modules.net_tools.nios import nios_network
from units.compat.mock import patch, MagicMock, Mock
from units.modules.utils import set_module_args
from .test_nios_module import TestNiosModule, load_fixture

@ -26,7 +26,6 @@ import tempfile
from units.compat import unittest
from units.compat.mock import patch
from ansible.module_utils import basic
from ansible.module_utils._text import to_bytes
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')

@ -25,7 +25,6 @@ import json
from units.compat import unittest
from units.compat.mock import patch
from ansible.module_utils import basic
from ansible.module_utils._text import to_bytes
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')

@ -17,7 +17,6 @@ if sys.version_info < (2, 7):
from ansible.module_utils.basic import AnsibleModule
try:
from library.modules.bigip_appsvcs_extension import ApiParameters
from library.modules.bigip_appsvcs_extension import ModuleParameters
from library.modules.bigip_appsvcs_extension import ModuleManager
from library.modules.bigip_appsvcs_extension import ArgumentSpec
@ -25,11 +24,9 @@ try:
# In Ansible 2.8, Ansible changed import paths.
from test.units.compat import unittest
from test.units.compat.mock import Mock
from test.units.compat.mock import patch
from test.units.modules.utils import set_module_args
except ImportError:
from ansible.modules.network.f5.bigip_appsvcs_extension import ApiParameters
from ansible.modules.network.f5.bigip_appsvcs_extension import ModuleParameters
from ansible.modules.network.f5.bigip_appsvcs_extension import ModuleManager
from ansible.modules.network.f5.bigip_appsvcs_extension import ArgumentSpec
@ -37,7 +34,6 @@ except ImportError:
# Ansible 2.8 imports
from units.compat import unittest
from units.compat.mock import Mock
from units.compat.mock import patch
from units.modules.utils import set_module_args

@ -25,7 +25,6 @@ try:
# In Ansible 2.8, Ansible changed import paths.
from test.units.compat import unittest
from test.units.compat.mock import Mock
from test.units.compat.mock import patch
from test.units.modules.utils import set_module_args
except ImportError:
@ -37,7 +36,6 @@ except ImportError:
# Ansible 2.8 imports
from units.compat import unittest
from units.compat.mock import Mock
from units.compat.mock import patch
from units.modules.utils import set_module_args

@ -17,7 +17,6 @@ if sys.version_info < (2, 7):
from ansible.module_utils.basic import AnsibleModule
try:
from library.modules.bigiq_application_fasthttp import ApiParameters
from library.modules.bigiq_application_fasthttp import ModuleParameters
from library.modules.bigiq_application_fasthttp import ModuleManager
from library.modules.bigiq_application_fasthttp import ArgumentSpec
@ -30,7 +29,6 @@ try:
from test.units.modules.utils import set_module_args
except ImportError:
from ansible.modules.network.f5.bigiq_application_fasthttp import ApiParameters
from ansible.modules.network.f5.bigiq_application_fasthttp import ModuleParameters
from ansible.modules.network.f5.bigiq_application_fasthttp import ModuleManager
from ansible.modules.network.f5.bigiq_application_fasthttp import ArgumentSpec

@ -17,7 +17,6 @@ if sys.version_info < (2, 7):
from ansible.module_utils.basic import AnsibleModule
try:
from library.modules.bigiq_application_fastl4_tcp import ApiParameters
from library.modules.bigiq_application_fastl4_tcp import ModuleParameters
from library.modules.bigiq_application_fastl4_tcp import ModuleManager
from library.modules.bigiq_application_fastl4_tcp import ArgumentSpec
@ -30,7 +29,6 @@ try:
from test.units.modules.utils import set_module_args
except ImportError:
from ansible.modules.network.f5.bigiq_application_fastl4_tcp import ApiParameters
from ansible.modules.network.f5.bigiq_application_fastl4_tcp import ModuleParameters
from ansible.modules.network.f5.bigiq_application_fastl4_tcp import ModuleManager
from ansible.modules.network.f5.bigiq_application_fastl4_tcp import ArgumentSpec

@ -17,7 +17,6 @@ if sys.version_info < (2, 7):
from ansible.module_utils.basic import AnsibleModule
try:
from library.modules.bigiq_application_fastl4_udp import ApiParameters
from library.modules.bigiq_application_fastl4_udp import ModuleParameters
from library.modules.bigiq_application_fastl4_udp import ModuleManager
from library.modules.bigiq_application_fastl4_udp import ArgumentSpec
@ -30,7 +29,6 @@ try:
from test.units.modules.utils import set_module_args
except ImportError:
from ansible.modules.network.f5.bigiq_application_fastl4_udp import ApiParameters
from ansible.modules.network.f5.bigiq_application_fastl4_udp import ModuleParameters
from ansible.modules.network.f5.bigiq_application_fastl4_udp import ModuleManager
from ansible.modules.network.f5.bigiq_application_fastl4_udp import ArgumentSpec

@ -17,7 +17,6 @@ if sys.version_info < (2, 7):
from ansible.module_utils.basic import AnsibleModule
try:
from library.modules.bigiq_application_http import ApiParameters
from library.modules.bigiq_application_http import ModuleParameters
from library.modules.bigiq_application_http import ModuleManager
from library.modules.bigiq_application_http import ArgumentSpec
@ -30,7 +29,6 @@ try:
from test.units.modules.utils import set_module_args
except ImportError:
from ansible.modules.network.f5.bigiq_application_http import ApiParameters
from ansible.modules.network.f5.bigiq_application_http import ModuleParameters
from ansible.modules.network.f5.bigiq_application_http import ModuleManager
from ansible.modules.network.f5.bigiq_application_http import ArgumentSpec

@ -17,7 +17,6 @@ if sys.version_info < (2, 7):
from ansible.module_utils.basic import AnsibleModule
try:
from library.modules.bigiq_application_https_offload import ApiParameters
from library.modules.bigiq_application_https_offload import ModuleParameters
from library.modules.bigiq_application_https_offload import ModuleManager
from library.modules.bigiq_application_https_offload import ArgumentSpec
@ -30,7 +29,6 @@ try:
from test.units.modules.utils import set_module_args
except ImportError:
from ansible.modules.network.f5.bigiq_application_https_offload import ApiParameters
from ansible.modules.network.f5.bigiq_application_https_offload import ModuleParameters
from ansible.modules.network.f5.bigiq_application_https_offload import ModuleManager
from ansible.modules.network.f5.bigiq_application_https_offload import ArgumentSpec

@ -17,7 +17,6 @@ if sys.version_info < (2, 7):
from ansible.module_utils.basic import AnsibleModule
try:
from library.modules.bigiq_application_https_waf import ApiParameters
from library.modules.bigiq_application_https_waf import ModuleParameters
from library.modules.bigiq_application_https_waf import ModuleManager
from library.modules.bigiq_application_https_waf import ArgumentSpec
@ -30,7 +29,6 @@ try:
from test.units.modules.utils import set_module_args
except ImportError:
from ansible.modules.network.f5.bigiq_application_https_waf import ApiParameters
from ansible.modules.network.f5.bigiq_application_https_waf import ModuleParameters
from ansible.modules.network.f5.bigiq_application_https_waf import ModuleManager
from ansible.modules.network.f5.bigiq_application_https_waf import ArgumentSpec

@ -25,7 +25,6 @@ try:
# In Ansible 2.8, Ansible changed import paths.
from test.units.compat import unittest
from test.units.compat.mock import Mock
from test.units.compat.mock import patch
from test.units.modules.utils import set_module_args
except ImportError:
@ -37,7 +36,6 @@ except ImportError:
# Ansible 2.8 imports
from units.compat import unittest
from units.compat.mock import Mock
from units.compat.mock import patch
from units.modules.utils import set_module_args

@ -17,7 +17,6 @@ if sys.version_info < (2, 7):
from ansible.module_utils.basic import AnsibleModule
try:
from library.modules.bigiq_regkey_license_assignment import ApiParameters
from library.modules.bigiq_regkey_license_assignment import ModuleParameters
from library.modules.bigiq_regkey_license_assignment import ModuleManager
from library.modules.bigiq_regkey_license_assignment import ArgumentSpec
@ -29,7 +28,6 @@ try:
from test.units.modules.utils import set_module_args
except ImportError:
from ansible.modules.network.f5.bigiq_regkey_license_assignment import ApiParameters
from ansible.modules.network.f5.bigiq_regkey_license_assignment import ModuleParameters
from ansible.modules.network.f5.bigiq_regkey_license_assignment import ModuleManager
from ansible.modules.network.f5.bigiq_regkey_license_assignment import ArgumentSpec

@ -25,7 +25,6 @@ try:
# In Ansible 2.8, Ansible changed import paths.
from test.units.compat import unittest
from test.units.compat.mock import Mock
from test.units.compat.mock import patch
from test.units.modules.utils import set_module_args
except ImportError:
@ -37,7 +36,6 @@ except ImportError:
# Ansible 2.8 imports
from units.compat import unittest
from units.compat.mock import Mock
from units.compat.mock import patch
from units.modules.utils import set_module_args

@ -17,7 +17,6 @@ if sys.version_info < (2, 7):
from ansible.module_utils.basic import AnsibleModule
try:
from library.modules.bigiq_utility_license_assignment import ApiParameters
from library.modules.bigiq_utility_license_assignment import ModuleParameters
from library.modules.bigiq_utility_license_assignment import ModuleManager
from library.modules.bigiq_utility_license_assignment import ArgumentSpec
@ -25,11 +24,9 @@ try:
# In Ansible 2.8, Ansible changed import paths.
from test.units.compat import unittest
from test.units.compat.mock import Mock
from test.units.compat.mock import patch
from test.units.modules.utils import set_module_args
except ImportError:
from ansible.modules.network.f5.bigiq_utility_license_assignment import ApiParameters
from ansible.modules.network.f5.bigiq_utility_license_assignment import ModuleParameters
from ansible.modules.network.f5.bigiq_utility_license_assignment import ModuleManager
from ansible.modules.network.f5.bigiq_utility_license_assignment import ArgumentSpec
@ -37,7 +34,6 @@ except ImportError:
# Ansible 2.8 imports
from units.compat import unittest
from units.compat.mock import Mock
from units.compat.mock import patch
from units.modules.utils import set_module_args

@ -17,8 +17,6 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
from mock import ANY
from ansible.module_utils.network.fortios.fortios import FortiOSHandler

@ -17,8 +17,6 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
from mock import ANY
from ansible.module_utils.network.fortios.fortios import FortiOSHandler

@ -17,8 +17,6 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
from mock import ANY
from ansible.module_utils.network.fortios.fortios import FortiOSHandler

@ -7,7 +7,6 @@ from units.compat.mock import patch
from ansible.modules.network.icx import icx_ping
from units.modules.utils import set_module_args
from .icx_module import TestICXModule, load_fixture
import traceback
class TestICXPingModule(TestICXModule):

@ -29,7 +29,6 @@ __metaclass__ = type
from units.compat import unittest
from ansible.module_utils import basic
from ansible.module_utils._text import to_bytes
from ansible.modules.network.netact import netact_cm_command
from units.compat.mock import patch

@ -12,7 +12,6 @@ import tempfile
from units.compat import unittest
from units.compat.mock import patch
from ansible.module_utils import basic
from ansible.module_utils._text import to_bytes
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')

@ -23,7 +23,6 @@ import json
from units.compat import unittest
from units.compat.mock import patch
from ansible.module_utils import basic
from ansible.module_utils._text import to_bytes
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')

@ -12,9 +12,6 @@ from ansible.modules.packaging.os import redhat_subscription
import pytest
import os
import tempfile
TESTED_MODULE = redhat_subscription.__name__

@ -2,7 +2,6 @@
# Copyright (c) 2017 Pierre-Louis Bonicoli <pierre-louis@libregerbil.fr>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from itertools import product
import json
from ansible.modules.packaging.os import rhn_channel

@ -2,8 +2,6 @@ import json
import pytest
from units.compat import mock
from ansible.module_utils import basic
from ansible.module_utils._text import to_bytes
from ansible.modules.remote_management.lxca import lxca_nodes
from ansible.module_utils.remote_management.lxca.common import setup_conn
from ansible.module_utils.remote_management.lxca.common import close_conn

@ -2,7 +2,6 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from units.compat import unittest
from oneview_module_loader import OneViewModuleBase
from ansible.modules.remote_management.oneview.oneview_enclosure_facts import EnclosureFactsModule
from hpe_test_utils import FactsParamsTestCase

@ -4,7 +4,6 @@
from copy import deepcopy
from units.compat import unittest, mock
from oneview_module_loader import OneViewModuleBase
from ansible.modules.remote_management.oneview.oneview_logical_interconnect_group import LogicalInterconnectGroupModule
from hpe_test_utils import OneViewBaseTestCase

@ -2,7 +2,6 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from units.compat import unittest
from oneview_module_loader import OneViewModuleBase
from ansible.modules.remote_management.oneview.oneview_logical_interconnect_group_facts import LogicalInterconnectGroupFactsModule
from hpe_test_utils import FactsParamsTestCase

@ -10,7 +10,6 @@ sys.modules['hpe3par_sdk.client'] = mock.Mock()
sys.modules['hpe3parclient'] = mock.Mock()
sys.modules['hpe3parclient.exceptions'] = mock.Mock()
from ansible.modules.storage.hpe3par import ss_3par_cpg
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.storage.hpe3par import hpe3par

@ -5,7 +5,7 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.modules.storage.netapp.netapp_e_facts import Facts
from units.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args
from units.modules.utils import AnsibleFailJson, ModuleTestCase, set_module_args
from units.compat import mock

@ -1,18 +1,11 @@
# (c) 2018, NetApp Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from mock import MagicMock
from ansible.module_utils import netapp
from ansible.modules.storage.netapp import netapp_e_host
from ansible.modules.storage.netapp.netapp_e_host import Host
from ansible.modules.storage.netapp.netapp_e_iscsi_interface import IscsiInterface
from units.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args
__metaclass__ = type
import mock
from units.compat.mock import patch
from ansible.module_utils._text import to_bytes
class IscsiInterfaceTest(ModuleTestCase):

@ -2,8 +2,6 @@
# (c) 2018, NetApp Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from mock import MagicMock
from ansible.modules.storage.netapp.netapp_e_iscsi_target import IscsiTarget
from units.modules.utils import AnsibleFailJson, ModuleTestCase, set_module_args

@ -2,8 +2,6 @@
# (c) 2018, NetApp Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from mock import MagicMock
from ansible.modules.storage.netapp.netapp_e_mgmt_interface import MgmtInterface
from units.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args

@ -2,7 +2,6 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from ansible.modules.storage.netapp.netapp_e_syslog import Syslog
from ansible.module_utils.six.moves.urllib.error import HTTPError
from units.modules.utils import AnsibleFailJson, ModuleTestCase, set_module_args
__metaclass__ = type

@ -25,7 +25,6 @@ from units.compat.mock import patch, MagicMock
from ansible.errors import AnsibleError, AnsibleParserError
from ansible.module_utils.common._collections_compat import Container
from ansible.playbook.block import Block
from ansible.playbook.task import Task
from units.mock.loader import DictDataLoader
from units.mock.path import mock_unfrackpath_noop

@ -23,9 +23,7 @@ from units.compat import unittest
from units.compat.mock import patch, MagicMock
from ansible.errors import AnsibleParserError
from ansible.playbook.block import Block
from ansible.playbook.play import Play
from ansible.playbook.role import Role
from units.mock.loader import DictDataLoader
from units.mock.path import mock_unfrackpath_noop

@ -20,7 +20,6 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat import unittest
from units.compat.mock import MagicMock
from ansible.errors import AnsibleParserError
from ansible.playbook import Playbook
from ansible.vars.manager import VariableManager

@ -15,8 +15,6 @@ import os
import unittest
import yaml
from pprint import pprint
import ansible.plugins
from units.compat.mock import patch, MagicMock
from ansible.plugins.action.synchronize import ActionModule

@ -23,11 +23,8 @@ __metaclass__ = type
import sys
import pytest
from io import StringIO
from units.compat import unittest
from units.compat.mock import patch, MagicMock, PropertyMock
from ansible.errors import AnsibleConnectionFailure
from ansible.playbook.play_context import PlayContext
pytest.importorskip("ncclient")

@ -23,8 +23,6 @@ __metaclass__ = type
import re
import json
from io import StringIO
from units.compat import unittest
from units.compat.mock import patch, MagicMock

@ -10,7 +10,7 @@ import pytest
from io import StringIO
from units.compat.mock import patch, MagicMock
from units.compat.mock import MagicMock
from ansible.errors import AnsibleConnectionFailure
from ansible.module_utils._text import to_bytes
from ansible.playbook.play_context import PlayContext

@ -22,7 +22,7 @@ import pytest
from units.compat import unittest
from ansible.errors import AnsibleFilterError
from ansible.plugins.filter.ipaddr import (ipaddr, _netmask_query, nthhost, next_nth_usable, ipsubnet,
from ansible.plugins.filter.ipaddr import (ipaddr, next_nth_usable, ipsubnet,
previous_nth_usable, network_in_usable, network_in_network,
cidr_merge, ipmath)
netaddr = pytest.importorskip('netaddr')

@ -26,8 +26,6 @@ from units.compat import unittest
from ansible.plugins.filter.network import (HAS_PASSLIB, parse_xml, type5_pw, hash_salt,
comp_type5, vlan_parser)
from ansible.errors import AnsibleFilterError
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures', 'network')
with open(os.path.join(fixture_path, 'show_vlans_xml_output.txt')) as f:

@ -6,8 +6,6 @@ import json
from ansible.module_utils.six.moves.urllib.error import HTTPError
from units.compat import mock
from units.compat import unittest
from units.compat.builtins import BUILTINS
from units.compat.mock import patch
from ansible.errors import AnsibleConnectionFailure
from ansible.module_utils.connection import ConnectionError

@ -20,7 +20,6 @@ from __future__ import (absolute_import, division, print_function)
import pytest
import datetime
from copy import copy
from ansible.errors import AnsibleError

@ -39,7 +39,6 @@ from ansible.module_utils.six.moves import builtins
from ansible.module_utils._text import to_bytes
from ansible.plugins.loader import PluginLoader
from ansible.plugins.lookup import password
from ansible.utils import encrypt
DEFAULT_CHARS = sorted([u'ascii_letters', u'digits', u".,:-_"])

@ -25,13 +25,11 @@ import uuid
from units.compat import unittest
from units.compat.mock import patch, MagicMock
from ansible.errors import AnsibleParserError
from ansible.executor.process.worker import WorkerProcess
from ansible.executor.task_queue_manager import TaskQueueManager
from ansible.executor.task_result import TaskResult
from ansible.inventory.host import Host
from ansible.module_utils.six.moves import queue as Queue
from ansible.playbook.block import Block
from ansible.playbook.handler import Handler
from ansible.plugins.strategy import StrategyBase

@ -19,8 +19,6 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from os import path
from mock import MagicMock
from units.compat import unittest

@ -23,7 +23,6 @@ import sys
from collections import defaultdict
from units.compat import unittest
from units.compat.mock import MagicMock
from ansible.template.safe_eval import safe_eval

Loading…
Cancel
Save