diff --git a/pyproject.toml b/pyproject.toml index f9644220..b6822a51 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -98,7 +98,6 @@ disable = [ "too-many-statements", "unexpected-keyword-arg", "unused-argument", - "unused-import", "unused-variable", "use-a-generator", "use-dict-literal", @@ -106,7 +105,6 @@ disable = [ "used-before-assignment", "useless-object-inheritance", "using-constant-test", - "wrong-import-order", ] [tool.pytest] diff --git a/src/pytest_ansible/module_dispatcher/v2.py b/src/pytest_ansible/module_dispatcher/v2.py index 8f6467d4..1d2b2ef1 100644 --- a/src/pytest_ansible/module_dispatcher/v2.py +++ b/src/pytest_ansible/module_dispatcher/v2.py @@ -2,7 +2,6 @@ import warnings -from typing import Any from typing import Sequence import ansible.constants diff --git a/src/pytest_ansible/module_dispatcher/v212.py b/src/pytest_ansible/module_dispatcher/v212.py index 0fe7fe20..e1b872ec 100644 --- a/src/pytest_ansible/module_dispatcher/v212.py +++ b/src/pytest_ansible/module_dispatcher/v212.py @@ -13,6 +13,7 @@ from ansible.executor.task_queue_manager import TaskQueueManager from ansible.playbook.play import Play from ansible.plugins.callback import CallbackBase +from ansible.plugins.loader import module_loader from pytest_ansible.errors import AnsibleConnectionFailure from pytest_ansible.has_version import has_ansible_v212 @@ -23,7 +24,6 @@ # pylint: disable=ungrouped-imports, wrong-import-position if not has_ansible_v212: raise ImportError("Only supported with ansible-2.12 and newer") -from ansible.plugins.loader import module_loader # pylint: enable=ungrouped-imports diff --git a/src/pytest_ansible/module_dispatcher/v213.py b/src/pytest_ansible/module_dispatcher/v213.py index 907bc99d..8e386cc4 100644 --- a/src/pytest_ansible/module_dispatcher/v213.py +++ b/src/pytest_ansible/module_dispatcher/v213.py @@ -9,6 +9,7 @@ from ansible.executor.task_queue_manager import TaskQueueManager from ansible.playbook.play import Play from ansible.plugins.callback import CallbackBase +from ansible.plugins.loader import module_loader from pytest_ansible.errors import AnsibleConnectionFailure from pytest_ansible.has_version import has_ansible_v213 @@ -20,7 +21,6 @@ if not has_ansible_v213: raise ImportError("Only supported with ansible-2.13 and newer") -from ansible.plugins.loader import module_loader # pylint: enable=ungrouped-imports diff --git a/src/pytest_ansible/module_dispatcher/v24.py b/src/pytest_ansible/module_dispatcher/v24.py index 98338d6f..45622b5f 100644 --- a/src/pytest_ansible/module_dispatcher/v24.py +++ b/src/pytest_ansible/module_dispatcher/v24.py @@ -8,6 +8,7 @@ from ansible.executor.task_queue_manager import TaskQueueManager from ansible.playbook.play import Play from ansible.plugins.callback import CallbackBase +from ansible.plugins.loader import module_loader from pytest_ansible.errors import AnsibleConnectionFailure from pytest_ansible.has_version import has_ansible_v24 @@ -19,7 +20,6 @@ if not has_ansible_v24: raise ImportError("Only supported with ansible-2.4 and newer") -from ansible.plugins.loader import module_loader # pylint: enable=ungrouped-imports diff --git a/src/pytest_ansible/module_dispatcher/v28.py b/src/pytest_ansible/module_dispatcher/v28.py index 3989a364..c44b19b9 100644 --- a/src/pytest_ansible/module_dispatcher/v28.py +++ b/src/pytest_ansible/module_dispatcher/v28.py @@ -9,6 +9,7 @@ from ansible.executor.task_queue_manager import TaskQueueManager from ansible.playbook.play import Play from ansible.plugins.callback import CallbackBase +from ansible.plugins.loader import module_loader from pytest_ansible.errors import AnsibleConnectionFailure from pytest_ansible.has_version import has_ansible_v28 @@ -19,7 +20,6 @@ # pylint: disable=ungrouped-imports, wrong-import-position if not has_ansible_v28: raise ImportError("Only supported with ansible-2.8 and newer") -from ansible.plugins.loader import module_loader # pylint: enable=ungrouped-imports diff --git a/src/pytest_ansible/module_dispatcher/v29.py b/src/pytest_ansible/module_dispatcher/v29.py index 4e794d8d..e7f37d10 100644 --- a/src/pytest_ansible/module_dispatcher/v29.py +++ b/src/pytest_ansible/module_dispatcher/v29.py @@ -9,6 +9,7 @@ from ansible.executor.task_queue_manager import TaskQueueManager from ansible.playbook.play import Play from ansible.plugins.callback import CallbackBase +from ansible.plugins.loader import module_loader from pytest_ansible.errors import AnsibleConnectionFailure from pytest_ansible.has_version import has_ansible_v29 @@ -20,7 +21,6 @@ if not has_ansible_v29: raise ImportError("Only supported with ansible-2.9 and newer") -from ansible.plugins.loader import module_loader # pylint: enable=ungrouped-imports diff --git a/src/pytest_ansible/results.py b/src/pytest_ansible/results.py index aff288c1..c34927c9 100644 --- a/src/pytest_ansible/results.py +++ b/src/pytest_ansible/results.py @@ -1,7 +1,5 @@ """Fixme.""" -import ansible.errors # NOQA - class ModuleResult(dict): diff --git a/tests/test_adhoc.py b/tests/test_adhoc.py index f27914a1..4e287a68 100644 --- a/tests/test_adhoc.py +++ b/tests/test_adhoc.py @@ -1,6 +1,7 @@ import pytest +# pylint: disable=unused-import try: from _pytest.main import EXIT_INTERRUPTED # type: ignore[attr-defined] from _pytest.main import EXIT_NOTESTSCOLLECTED # type: ignore[attr-defined] diff --git a/tests/test_fixtures.py b/tests/test_fixtures.py index 73bc4cf8..134fd634 100644 --- a/tests/test_fixtures.py +++ b/tests/test_fixtures.py @@ -1,3 +1,4 @@ +# pylint: disable=unused-import import pytest diff --git a/tests/test_module_dispatcher.py b/tests/test_module_dispatcher.py index 33666760..1f1e9cd8 100644 --- a/tests/test_module_dispatcher.py +++ b/tests/test_module_dispatcher.py @@ -15,6 +15,7 @@ def test_runtime_error(): bmd._run("foo") +# pylint: disable=unused-import @pytest.mark.requires_ansible_v1 def test_importerror_requires_v2(): with pytest.raises(ImportError): diff --git a/tests/test_params.py b/tests/test_params.py index 34c66473..23d64faa 100644 --- a/tests/test_params.py +++ b/tests/test_params.py @@ -11,6 +11,7 @@ from pytest_ansible.has_version import has_ansible_v28 +# pylint: disable=unused-import try: from _pytest.main import EXIT_INTERRUPTED # type: ignore[attr-defined] from _pytest.main import EXIT_NOTESTSCOLLECTED # type: ignore[attr-defined] @@ -26,6 +27,7 @@ EXIT_INTERRUPTED = ExitCode.INTERRUPTED EXIT_NOTESTSCOLLECTED = ExitCode.NO_TESTS_COLLECTED +# pylint: disable=unused-import if sys.version_info[0] == 2: import __builtin__ as builtins # NOQA else: