mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[PR #5978/9f87989e backport][stable-6] Remove unnecessary test imports (#5979)
Remove unnecessary test imports (#5978)
Remove unnecessary test imports.
(cherry picked from commit 9f87989e7f
)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
554ec94110
commit
3d70bfa1e4
71 changed files with 70 additions and 121 deletions
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
import yaml
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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')
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
1
tests/unit/plugins/cache/test_redis.py
vendored
1
tests/unit/plugins/cache/test_redis.py
vendored
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 = [
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import textwrap
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import requests
|
||||
import re
|
||||
import json
|
||||
import sys
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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/"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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:'
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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')
|
||||
|
||||
|
|
|
@ -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 = {
|
||||
|
|
Loading…
Reference in a new issue