Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unused-import & wrong-import-order check #98

Merged
merged 1 commit into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,13 @@ disable = [
"too-many-statements",
"unexpected-keyword-arg",
"unused-argument",
"unused-import",
"unused-variable",
"use-a-generator",
"use-dict-literal",
"use-list-literal",
"used-before-assignment",
"useless-object-inheritance",
"using-constant-test",
"wrong-import-order",
]

[tool.pytest]
Expand Down
1 change: 0 additions & 1 deletion src/pytest_ansible/module_dispatcher/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import warnings

from typing import Any
from typing import Sequence

import ansible.constants
Expand Down
2 changes: 1 addition & 1 deletion src/pytest_ansible/module_dispatcher/v212.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/pytest_ansible/module_dispatcher/v213.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/pytest_ansible/module_dispatcher/v24.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/pytest_ansible/module_dispatcher/v28.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/pytest_ansible/module_dispatcher/v29.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/pytest_ansible/results.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Fixme."""

import ansible.errors # NOQA


class ModuleResult(dict):

Expand Down
1 change: 1 addition & 0 deletions tests/test_adhoc.py
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
1 change: 1 addition & 0 deletions tests/test_fixtures.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# pylint: disable=unused-import
import pytest


Expand Down
1 change: 1 addition & 0 deletions tests/test_module_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 2 additions & 0 deletions tests/test_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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:
Expand Down