1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Remove unnecessary test imports (#5978)

Remove unnecessary test imports.
This commit is contained in:
Felix Fontein 2023-02-12 21:05:08 +01:00 committed by GitHub
parent 2b8ac3c629
commit 9f87989e7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
71 changed files with 70 additions and 121 deletions

View file

@ -34,7 +34,7 @@ from ansible_collections.community.general.plugins.module_utils.module_helper im
from ansible.module_utils.basic import missing_required_lib from ansible.module_utils.basic import missing_required_lib
with ModuleHelper.dependency("nopackagewiththisname", missing_required_lib("nopackagewiththisname")): with ModuleHelper.dependency("nopackagewiththisname", missing_required_lib("nopackagewiththisname")):
import nopackagewiththisname import nopackagewiththisname # noqa: F401, pylint: disable=unused-import
class MSimple(ModuleHelper): class MSimple(ModuleHelper):

View file

@ -6,7 +6,6 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
import collections
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = '''
@ -26,7 +25,9 @@ EXAMPLES = ""
RETURN = "" RETURN = ""
from ansible_collections.community.general.plugins.module_utils.module_helper import ModuleHelper 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): class MSimpleDA(ModuleHelper):

View file

@ -6,7 +6,6 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import os
import sys import sys
import yaml import yaml

View file

@ -13,8 +13,7 @@ import sys
import yaml import yaml
from voluptuous import All, Any, MultipleInvalid, PREVENT_EXTRA from voluptuous import Any, MultipleInvalid, PREVENT_EXTRA, Schema
from voluptuous import Required, Schema, Invalid
from voluptuous.humanize import humanize_error from voluptuous.humanize import humanize_error

View file

@ -13,7 +13,7 @@ __metaclass__ = type
# One unittest needs to import builtins via __import__() so we need to have # One unittest needs to import builtins via __import__() so we need to have
# the string that represents it # the string that represents it
try: try:
import __builtin__ import __builtin__ # noqa: F401, pylint: disable=unused-import
except ImportError: except ImportError:
BUILTINS = 'builtins' BUILTINS = 'builtins'
else: else:

View file

@ -20,12 +20,12 @@ try:
# Allow wildcard import because we really do want to import all of mock's # Allow wildcard import because we really do want to import all of mock's
# symbols into this compat shim # symbols into this compat shim
# pylint: disable=wildcard-import,unused-wildcard-import # pylint: disable=wildcard-import,unused-wildcard-import
from unittest.mock import * from unittest.mock import * # noqa: F401, pylint: disable=unused-import
except ImportError: except ImportError:
# Python 2 # Python 2
# pylint: disable=wildcard-import,unused-wildcard-import # pylint: disable=wildcard-import,unused-wildcard-import
try: try:
from mock import * from mock import * # noqa: F401, pylint: disable=unused-import
except ImportError: except ImportError:
print('You need the mock library installed on python2.x to run tests') print('You need the mock library installed on python2.x to run tests')

View file

@ -18,8 +18,8 @@ import sys
if sys.version_info < (2, 7): if sys.version_info < (2, 7):
try: try:
# Need unittest2 on python2.6 # Need unittest2 on python2.6
from unittest2 import * from unittest2 import * # noqa: F401, pylint: disable=unused-import
except ImportError: except ImportError:
print('You need unittest2 installed on python2.6.x to run tests') print('You need unittest2 installed on python2.6.x to run tests')
else: else:
from unittest import * from unittest import * # noqa: F401, pylint: disable=unused-import

View file

@ -8,7 +8,6 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
from ansible.errors import AnsibleError
from ansible.plugins.loader import become_loader, get_shell_plugin from ansible.plugins.loader import become_loader, get_shell_plugin

View file

@ -10,7 +10,6 @@ import pytest
pytest.importorskip('redis') pytest.importorskip('redis')
from ansible import constants as C
from ansible.plugins.loader import cache_loader from ansible.plugins.loader import cache_loader
from ansible_collections.community.general.plugins.cache.redis import CacheModule as RedisCache from ansible_collections.community.general.plugins.cache.redis import CacheModule as RedisCache

View file

@ -7,7 +7,7 @@ __metaclass__ = type
from ansible.executor.task_result import TaskResult 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 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 ansible_collections.community.general.plugins.callback.loganalytics import AzureLogAnalyticsSource
from datetime import datetime from datetime import datetime

View file

@ -10,7 +10,7 @@ from ansible.playbook.task import Task
from ansible.executor.task_result import TaskResult 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 import unittest
from ansible_collections.community.general.tests.unit.compat.mock import patch, MagicMock, Mock 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 from collections import OrderedDict
import sys import sys

View file

@ -7,7 +7,7 @@ __metaclass__ = type
from ansible.executor.task_result import TaskResult 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 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 ansible_collections.community.general.plugins.callback.splunk import SplunkHTTPCollectorSource
from datetime import datetime from datetime import datetime

View file

@ -7,7 +7,6 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
from io import StringIO from io import StringIO
import pytest
from ansible_collections.community.general.tests.unit.compat import unittest from ansible_collections.community.general.tests.unit.compat import unittest
from ansible_collections.community.general.plugins.connection import lxc from ansible_collections.community.general.plugins.connection import lxc

View file

@ -7,7 +7,6 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
from ansible_collections.community.general.tests.unit.compat import unittest 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 from ansible_collections.community.general.plugins.filter.crc32 import crc32s

View file

@ -7,9 +7,7 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import pytest import pytest
import sys
from ansible.errors import AnsibleError, AnsibleParserError
from ansible_collections.community.general.plugins.inventory.cobbler import InventoryModule from ansible_collections.community.general.plugins.inventory.cobbler import InventoryModule

View file

@ -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.parsing.dataloader import DataLoader
from ansible.template import Templar from ansible.template import Templar
from ansible_collections.community.general.plugins.inventory.linode import InventoryModule from ansible_collections.community.general.plugins.inventory.linode import InventoryModule

View file

@ -8,9 +8,7 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import pytest import pytest
import os
from ansible.errors import AnsibleError
from ansible.inventory.data import InventoryData from ansible.inventory.data import InventoryData
from ansible_collections.community.general.plugins.inventory.lxd import InventoryModule from ansible_collections.community.general.plugins.inventory.lxd import InventoryModule

View file

@ -10,7 +10,6 @@ __metaclass__ = type
import pytest import pytest
from ansible.errors import AnsibleError, AnsibleParserError
from ansible.inventory.data import InventoryData from ansible.inventory.data import InventoryData
from ansible_collections.community.general.plugins.inventory.xen_orchestra import InventoryModule from ansible_collections.community.general.plugins.inventory.xen_orchestra import InventoryModule

View file

@ -6,15 +6,13 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
from argparse import ArgumentParser
from ansible_collections.community.general.tests.unit.compat import unittest from ansible_collections.community.general.tests.unit.compat import unittest
from ansible_collections.community.general.tests.unit.compat.mock import patch from ansible_collections.community.general.tests.unit.compat.mock import patch
from ansible.errors import AnsibleError from ansible.errors import AnsibleError
from ansible.module_utils import six from ansible.module_utils import six
from ansible.plugins.loader import lookup_loader 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 = [ MOCK_RECORDS = [

View file

@ -8,10 +8,8 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import pytest
from ansible_collections.community.general.tests.unit.compat import unittest from ansible_collections.community.general.tests.unit.compat import unittest
from ansible_collections.community.general.tests.unit.compat.mock import patch, MagicMock 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_collections.community.general.plugins.lookup import etcd3
from ansible.plugins.loader import lookup_loader from ansible.plugins.loader import lookup_loader

View file

@ -14,7 +14,7 @@ from ansible_collections.community.general.tests.unit.compat.mock import patch
from ansible.errors import AnsibleError from ansible.errors import AnsibleError
from ansible.module_utils import six from ansible.module_utils import six
from ansible.plugins.loader import lookup_loader 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', MOCK_ENTRIES = [{'username': 'user',

View file

@ -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.six.moves.urllib.error import HTTPError, URLError
from ansible.module_utils import six from ansible.module_utils import six
from ansible.plugins.loader import lookup_loader 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 json
import os import os

View file

@ -5,8 +5,6 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import random
from ansible_collections.community.general.tests.unit.compat import unittest from ansible_collections.community.general.tests.unit.compat import unittest
from ansible_collections.community.general.plugins.module_utils.scaleway import SecretVariables, argon2 from ansible_collections.community.general.plugins.module_utils.scaleway import SecretVariables, argon2

View file

@ -95,14 +95,14 @@ def test_arg_format_fail(fmt, style, stars, value, expected):
def test_dependency_ctxmgr(): def test_dependency_ctxmgr():
ctx = DependencyCtxMgr("POTATOES", "Potatoes must be installed") ctx = DependencyCtxMgr("POTATOES", "Potatoes must be installed")
with ctx: 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)) print("POTATOES: ctx.text={0}".format(ctx.text))
assert ctx.text == "Potatoes must be installed" assert ctx.text == "Potatoes must be installed"
assert not ctx.has_it assert not ctx.has_it
ctx = DependencyCtxMgr("POTATOES2") ctx = DependencyCtxMgr("POTATOES2")
with ctx: 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 assert not ctx.has_it
print("POTATOES2: ctx.text={0}".format(ctx.text)) print("POTATOES2: ctx.text={0}".format(ctx.text))
assert ctx.text.startswith("No module named") assert ctx.text.startswith("No module named")
@ -110,7 +110,7 @@ def test_dependency_ctxmgr():
ctx = DependencyCtxMgr("TYPING") ctx = DependencyCtxMgr("TYPING")
with ctx: with ctx:
import sys import sys # noqa: F401, pylint: disable=unused-import
assert ctx.has_it assert ctx.has_it

View file

@ -6,7 +6,6 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import os
import textwrap import textwrap
import pytest import pytest

View file

@ -13,7 +13,6 @@ import yaml
from mock import Mock, patch from mock import Mock, patch
from .oneview_module_loader import ONEVIEW_MODULE_UTILS_PATH 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 from hpOneView.oneview_client import OneViewClient

View file

@ -15,18 +15,22 @@ if 'hpOneView' not in sys.modules:
sys.modules['hpOneView.oneview_client'] = Mock() sys.modules['hpOneView.oneview_client'] = Mock()
ONEVIEW_MODULE_UTILS_PATH = 'ansible_collections.community.general.plugins.module_utils.oneview' ONEVIEW_MODULE_UTILS_PATH = 'ansible_collections.community.general.plugins.module_utils.oneview'
from ansible_collections.community.general.plugins.module_utils.oneview import (OneViewModuleException, from ansible_collections.community.general.plugins.module_utils.oneview import ( # noqa: F401, pylint: disable=unused-import
OneViewModuleTaskError, OneViewModuleException,
OneViewModuleResourceNotFound, OneViewModuleTaskError,
OneViewModuleBase) OneViewModuleResourceNotFound,
OneViewModuleBase,
)
from ansible_collections.community.general.plugins.modules.oneview_ethernet_network import EthernetNetworkModule 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 EthernetNetworkInfoModule from ansible_collections.community.general.plugins.modules.oneview_ethernet_network_info import ( # noqa: F401, pylint: disable=unused-import
from ansible_collections.community.general.plugins.modules.oneview_fc_network import FcNetworkModule EthernetNetworkInfoModule,
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_fc_network import FcNetworkModule # noqa: F401, pylint: disable=unused-import
from ansible_collections.community.general.plugins.modules.oneview_fcoe_network_info import FcoeNetworkInfoModule 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_network_set import NetworkSetModule 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_network_set_info import NetworkSetInfoModule 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_san_manager import SanManagerModule 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_san_manager_info import SanManagerInfoModule 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

View file

@ -5,7 +5,6 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
from ansible_collections.community.general.tests.unit.compat.mock import patch
from ansible.module_utils.six.moves import xmlrpc_client from ansible.module_utils.six.moves import xmlrpc_client
import pytest import pytest

View file

@ -7,7 +7,7 @@ __metaclass__ = type
import json import json
import pytest 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.plugins.modules import alerta_customer
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, AnsibleFailJson, ModuleTestCase, set_module_args

View file

@ -7,7 +7,7 @@ __metaclass__ = type
import json import json
import pytest 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.plugins.modules import discord
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, AnsibleFailJson, ModuleTestCase, set_module_args

View file

@ -5,7 +5,6 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import requests
import re import re
import json import json
import sys import sys

View file

@ -31,7 +31,7 @@ try:
# GitLab module requirements # GitLab module requirements
if python_version_match_requirement(): 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_req_version = python_gitlab_version_match_requirement()
gitlab_module_version = python_gitlab_module_version() gitlab_module_version = python_gitlab_module_version()
if LooseVersion(gitlab_module_version) < LooseVersion(gitlab_req_version): if LooseVersion(gitlab_module_version) < LooseVersion(gitlab_req_version):

View file

@ -10,8 +10,8 @@ __metaclass__ = type
from contextlib import contextmanager from contextlib import contextmanager
from ansible_collections.community.general.tests.unit.compat import unittest 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, AnsibleFailJson, ModuleTestCase, set_module_args 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 from ansible_collections.community.general.plugins.modules import keycloak_authentication

View file

@ -11,9 +11,8 @@ __metaclass__ = type
from contextlib import contextmanager from contextlib import contextmanager
from ansible_collections.community.general.tests.unit.compat import unittest 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, AnsibleFailJson, \ from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, ModuleTestCase, set_module_args
ModuleTestCase, set_module_args
from ansible_collections.community.general.plugins.modules import keycloak_client from ansible_collections.community.general.plugins.modules import keycloak_client

View file

@ -10,8 +10,8 @@ __metaclass__ = type
from contextlib import contextmanager from contextlib import contextmanager
from ansible_collections.community.general.tests.unit.compat import unittest 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, AnsibleFailJson, ModuleTestCase, set_module_args 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 from ansible_collections.community.general.plugins.modules import keycloak_client_rolemapping

View file

@ -11,9 +11,8 @@ __metaclass__ = type
from contextlib import contextmanager from contextlib import contextmanager
from ansible_collections.community.general.tests.unit.compat import unittest 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, AnsibleFailJson, \ from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, ModuleTestCase, set_module_args
ModuleTestCase, set_module_args
from ansible_collections.community.general.plugins.modules import keycloak_clientscope from ansible_collections.community.general.plugins.modules import keycloak_clientscope

View file

@ -10,8 +10,8 @@ __metaclass__ = type
from contextlib import contextmanager from contextlib import contextmanager
from ansible_collections.community.general.tests.unit.compat import unittest 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, AnsibleFailJson, ModuleTestCase, set_module_args 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 from ansible_collections.community.general.plugins.modules import keycloak_identity_provider

View file

@ -10,8 +10,8 @@ __metaclass__ = type
from contextlib import contextmanager from contextlib import contextmanager
from ansible_collections.community.general.tests.unit.compat import unittest 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, AnsibleFailJson, ModuleTestCase, set_module_args 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 from ansible_collections.community.general.plugins.modules import keycloak_realm

View file

@ -10,7 +10,7 @@ __metaclass__ = type
from contextlib import contextmanager from contextlib import contextmanager
from ansible_collections.community.general.tests.unit.compat import unittest 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.tests.unit.plugins.modules.utils import AnsibleExitJson, ModuleTestCase, set_module_args
from ansible_collections.community.general.plugins.modules import keycloak_realm_info from ansible_collections.community.general.plugins.modules import keycloak_realm_info

View file

@ -10,8 +10,8 @@ __metaclass__ = type
from contextlib import contextmanager from contextlib import contextmanager
from ansible_collections.community.general.tests.unit.compat import unittest 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, AnsibleFailJson, ModuleTestCase, set_module_args 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 from ansible_collections.community.general.plugins.modules import keycloak_role

View file

@ -10,8 +10,8 @@ __metaclass__ = type
from contextlib import contextmanager from contextlib import contextmanager
from ansible_collections.community.general.tests.unit.compat import unittest 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, AnsibleFailJson, ModuleTestCase, set_module_args 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 from ansible_collections.community.general.plugins.modules import keycloak_user_federation

View file

@ -10,7 +10,7 @@ import pytest
from ansible_collections.community.general.plugins.modules import linode from ansible_collections.community.general.plugins.modules import linode
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args 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: if not linode.HAS_LINODE:
pytestmark = pytest.mark.skip('test_linode.py requires the `linode-python` module') pytestmark = pytest.mark.skip('test_linode.py requires the `linode-python` module')

View file

@ -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.plugins.modules.utils import set_module_args
from ansible_collections.community.general.tests.unit.compat import mock 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): def test_mandatory_state_is_validated(capfd):

View file

@ -10,8 +10,6 @@ import json
import pytest import pytest
from ansible_collections.community.general.tests.unit.compat import mock 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.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') @pytest.fixture(scope='module')

View file

@ -5,7 +5,6 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
from ansible.module_utils import basic
from ansible_collections.community.general.plugins.modules import macports from ansible_collections.community.general.plugins.modules import macports
import pytest import pytest

View file

@ -8,8 +8,7 @@ __metaclass__ = type
from ansible_collections.community.general.tests.unit.compat.mock import call, patch 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.plugins.modules import npm
from ansible_collections.community.general.tests.unit.plugins.modules.utils import ( from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, ModuleTestCase, set_module_args
AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args)
class NPMModuleTestCase(ModuleTestCase): class NPMModuleTestCase(ModuleTestCase):

View file

@ -16,7 +16,7 @@ from ansible.module_utils import basic
import ansible_collections.community.general.plugins.modules.ocapi_command as module 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 AnsibleExitJson, AnsibleFailJson
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args, exit_json, fail_json 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/" MOCK_BASE_URI = "mockBaseUri/"

View file

@ -6,8 +6,6 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import os
import pytest import pytest
from ansible_collections.community.general.plugins.modules.one_vm import parse_updateconf from ansible_collections.community.general.plugins.modules.one_vm import parse_updateconf

View file

@ -8,7 +8,7 @@ __metaclass__ = type
import pytest import pytest
from .hpe_test_utils import FactsParamsTest 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 from ansible_collections.community.general.plugins.modules.oneview_datacenter_info import DatacenterInfoModule

View file

@ -6,7 +6,6 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
from .hpe_test_utils import FactsParamsTestCase 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.tests.unit.compat import unittest
from ansible_collections.community.general.plugins.modules.oneview_enclosure_info import EnclosureInfoModule from ansible_collections.community.general.plugins.modules.oneview_enclosure_info import EnclosureInfoModule

View file

@ -11,7 +11,6 @@ import yaml
from ansible_collections.community.general.tests.unit.compat import unittest, mock from ansible_collections.community.general.tests.unit.compat import unittest, mock
from .oneview_module_loader import EthernetNetworkModule from .oneview_module_loader import EthernetNetworkModule
from .oneview_conftest import mock_ov_client, mock_ansible_module
from .hpe_test_utils import OneViewBaseTestCase from .hpe_test_utils import OneViewBaseTestCase
FAKE_MSG_ERROR = 'Fake message error' FAKE_MSG_ERROR = 'Fake message error'

View file

@ -8,7 +8,6 @@ __metaclass__ = type
from ansible_collections.community.general.tests.unit.compat import unittest from ansible_collections.community.general.tests.unit.compat import unittest
from .oneview_module_loader import EthernetNetworkInfoModule from .oneview_module_loader import EthernetNetworkInfoModule
from .oneview_conftest import mock_ov_client, mock_ansible_module
from .hpe_test_utils import FactsParamsTestCase from .hpe_test_utils import FactsParamsTestCase
ERROR_MSG = 'Fake message error' ERROR_MSG = 'Fake message error'

View file

@ -9,7 +9,6 @@ __metaclass__ = type
from ansible_collections.community.general.tests.unit.compat import unittest from ansible_collections.community.general.tests.unit.compat import unittest
from .oneview_module_loader import FcNetworkModule from .oneview_module_loader import FcNetworkModule
from .oneview_conftest import mock_ov_client, mock_ansible_module
from .hpe_test_utils import OneViewBaseTestCase from .hpe_test_utils import OneViewBaseTestCase
FAKE_MSG_ERROR = 'Fake message error' FAKE_MSG_ERROR = 'Fake message error'

View file

@ -7,7 +7,6 @@ __metaclass__ = type
from ansible_collections.community.general.tests.unit.compat import unittest from ansible_collections.community.general.tests.unit.compat import unittest
from .oneview_module_loader import FcNetworkInfoModule from .oneview_module_loader import FcNetworkInfoModule
from .oneview_conftest import mock_ov_client, mock_ansible_module
from .hpe_test_utils import FactsParamsTestCase from .hpe_test_utils import FactsParamsTestCase
ERROR_MSG = 'Fake message error' ERROR_MSG = 'Fake message error'

View file

@ -9,7 +9,6 @@ __metaclass__ = type
from ansible_collections.community.general.tests.unit.compat import unittest from ansible_collections.community.general.tests.unit.compat import unittest
from .oneview_module_loader import FcoeNetworkModule from .oneview_module_loader import FcoeNetworkModule
from .oneview_conftest import mock_ov_client, mock_ansible_module
from .hpe_test_utils import OneViewBaseTestCase from .hpe_test_utils import OneViewBaseTestCase
FAKE_MSG_ERROR = 'Fake message error' FAKE_MSG_ERROR = 'Fake message error'

View file

@ -8,7 +8,6 @@ __metaclass__ = type
from ansible_collections.community.general.tests.unit.compat import unittest from ansible_collections.community.general.tests.unit.compat import unittest
from .oneview_module_loader import FcoeNetworkInfoModule from .oneview_module_loader import FcoeNetworkInfoModule
from .oneview_conftest import mock_ov_client, mock_ansible_module
from .hpe_test_utils import FactsParamsTestCase from .hpe_test_utils import FactsParamsTestCase
ERROR_MSG = 'Fake message error' ERROR_MSG = 'Fake message error'

View file

@ -9,7 +9,6 @@ from copy import deepcopy
from ansible_collections.community.general.tests.unit.compat import unittest, mock from ansible_collections.community.general.tests.unit.compat import unittest, mock
from .hpe_test_utils import OneViewBaseTestCase 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 from ansible_collections.community.general.plugins.modules.oneview_logical_interconnect_group import LogicalInterconnectGroupModule

View file

@ -7,7 +7,6 @@ __metaclass__ = type
from ansible_collections.community.general.tests.unit.compat import unittest from ansible_collections.community.general.tests.unit.compat import unittest
from .hpe_test_utils import FactsParamsTestCase 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 ( from ansible_collections.community.general.plugins.modules.oneview_logical_interconnect_group_info import (
LogicalInterconnectGroupInfoModule LogicalInterconnectGroupInfoModule
) )

View file

@ -8,7 +8,6 @@ __metaclass__ = type
from ansible_collections.community.general.tests.unit.compat import unittest, mock from ansible_collections.community.general.tests.unit.compat import unittest, mock
from .hpe_test_utils import OneViewBaseTestCase from .hpe_test_utils import OneViewBaseTestCase
from .oneview_module_loader import NetworkSetModule from .oneview_module_loader import NetworkSetModule
from .oneview_conftest import mock_ov_client, mock_ansible_module
FAKE_MSG_ERROR = 'Fake message error' FAKE_MSG_ERROR = 'Fake message error'

View file

@ -7,7 +7,6 @@ __metaclass__ = type
from ansible_collections.community.general.tests.unit.compat import unittest from ansible_collections.community.general.tests.unit.compat import unittest
from .oneview_module_loader import NetworkSetInfoModule from .oneview_module_loader import NetworkSetInfoModule
from .oneview_conftest import mock_ov_client, mock_ansible_module
from .hpe_test_utils import FactsParamsTestCase from .hpe_test_utils import FactsParamsTestCase
ERROR_MSG = 'Fake message error' ERROR_MSG = 'Fake message error'

View file

@ -7,7 +7,6 @@ __metaclass__ = type
from ansible_collections.community.general.tests.unit.compat import unittest, mock from ansible_collections.community.general.tests.unit.compat import unittest, mock
from .oneview_module_loader import SanManagerModule from .oneview_module_loader import SanManagerModule
from .oneview_conftest import mock_ov_client, mock_ansible_module
from .hpe_test_utils import OneViewBaseTestCase from .hpe_test_utils import OneViewBaseTestCase
from copy import deepcopy from copy import deepcopy

View file

@ -7,7 +7,6 @@ __metaclass__ = type
from ansible_collections.community.general.tests.unit.compat import unittest from ansible_collections.community.general.tests.unit.compat import unittest
from .oneview_module_loader import SanManagerInfoModule from .oneview_module_loader import SanManagerInfoModule
from .oneview_conftest import mock_ov_client, mock_ansible_module
from .hpe_test_utils import FactsParamsTestCase from .hpe_test_utils import FactsParamsTestCase

View file

@ -6,12 +6,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
import sys
from ansible.module_utils import basic 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 import mock
from ansible_collections.community.general.tests.unit.compat.mock import patch
from ansible_collections.community.general.tests.unit.plugins.modules.utils import ( from ansible_collections.community.general.tests.unit.plugins.modules.utils import (
AnsibleExitJson, AnsibleExitJson,
AnsibleFailJson, AnsibleFailJson,
@ -27,7 +24,6 @@ from ansible_collections.community.general.plugins.modules.pacman import (
) )
import pytest import pytest
import json
def get_bin_path(self, arg, required=False): def get_bin_path(self, arg, required=False):

View file

@ -15,13 +15,8 @@ import json
from ansible_collections.community.general.plugins.modules import proxmox_tasks_info from ansible_collections.community.general.plugins.modules import proxmox_tasks_info
import ansible_collections.community.general.plugins.module_utils.proxmox as proxmox_utils 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 patch
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.plugins.modules.utils import set_module_args 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' NODE = 'node01'
TASK_UPID = 'UPID:iaclab-01-01:000029DD:1599528B:6108F068:srvreload:networking:root@pam:' TASK_UPID = 'UPID:iaclab-01-01:000029DD:1599528B:6108F068:srvreload:networking:root@pam:'

View file

@ -21,7 +21,7 @@ HAS_REDIS_USERNAME_OPTION = True
if tuple(map(int, __version__.split('.'))) < (3, 4, 0): if tuple(map(int, __version__.split('.'))) < (3, 4, 0):
HAS_REDIS_USERNAME_OPTION = False HAS_REDIS_USERNAME_OPTION = False
if HAS_REDIS_USERNAME_OPTION: 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): def test_redis_data_incr_without_arguments(capfd):

View file

@ -10,7 +10,7 @@ import json
from ansible_collections.community.general.plugins.modules import rhn_channel 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 import pytest

View file

@ -15,7 +15,7 @@ import ansible.module_utils.six
from ansible.module_utils.six.moves import xmlrpc_client from ansible.module_utils.six.moves import xmlrpc_client
from ansible_collections.community.general.plugins.modules import rhn_register 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 import pytest

View file

@ -5,8 +5,6 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import pytest
from ansible_collections.community.general.plugins.modules import statsd 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.compat.mock import patch, MagicMock
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, AnsibleFailJson, ModuleTestCase, set_module_args

View file

@ -5,12 +5,9 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __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.mock import patch
from ansible_collections.community.general.tests.unit.compat import unittest from ansible_collections.community.general.tests.unit.compat import unittest
from ansible.module_utils import basic 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 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 AnsibleExitJson, AnsibleFailJson
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args, exit_json, fail_json from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args, exit_json, fail_json

View file

@ -12,7 +12,7 @@ import json
import pytest import pytest
from .xenserver_common import fake_xenapi_ref 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') pytestmark = pytest.mark.usefixtures('patch_ansible_module')

View file

@ -11,7 +11,7 @@ import json
import pytest import pytest
from .xenserver_common import fake_xenapi_ref 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 = { testcase_set_powerstate = {