Skip to content

Commit

Permalink
Add no-member check (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruchip16 authored Apr 17, 2023
1 parent 37d65e3 commit 155c16a
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ disable = [
"invalid-name",
"missing-function-docstring",
"missing-module-docstring",
"no-member",
"no-name-in-module",
"protected-access",
"redefined-outer-name",
Expand Down
3 changes: 2 additions & 1 deletion src/pytest_ansible/module_dispatcher/v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import ansible.errors
import ansible.utils
from ansible.runner import Runner
from ansible.utils import module_finder

from pytest_ansible.errors import AnsibleConnectionFailure
from pytest_ansible.has_version import has_ansible_v1
Expand All @@ -31,7 +32,7 @@ def has_module(self, name):
else:
ansible.utils.module_finder.add_directory(paths)

return ansible.utils.module_finder.has_plugin(name)
return module_finder.has_plugin(name)

def _run(self, *module_args, **complex_args):
"""Execute an ansible adhoc command returning the results in a AdHocResult object."""
Expand Down
8 changes: 5 additions & 3 deletions src/pytest_ansible/module_dispatcher/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,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_v2
Expand Down Expand Up @@ -60,11 +61,11 @@ def has_module(self, name):
paths = self.options["module_path"]
if isinstance(paths, (list, tuple, set)):
for path in paths:
ansible.plugins.module_loader.add_directory(path)
module_loader.add_directory(path)
else:
ansible.plugins.module_loader.add_directory(paths)
module_loader.add_directory(paths)

return ansible.plugins.module_loader.has_plugin(name)
return module_loader.has_plugin(name)

def _run(self, *module_args, **complex_args):
"""Execute an ansible adhoc command returning the result in a AdhocResult object."""
Expand All @@ -88,6 +89,7 @@ def _run(self, *module_args, **complex_args):
"Specified hosts and/or --limit does not match any hosts",
)

# pylint: disable=no-member
parser = CLI.base_parser(
runas_opts=True,
inventory_opts=True,
Expand Down
3 changes: 2 additions & 1 deletion src/pytest_ansible/module_dispatcher/v213.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import ansible.errors
import ansible.utils
from ansible.cli.adhoc import AdHocCLI
from ansible.constants import COLLECTIONS_PATHS
from ansible.executor.task_queue_manager import TaskQueueManager
from ansible.playbook.play import Play
from ansible.plugins.callback import CallbackBase
Expand Down Expand Up @@ -205,7 +206,7 @@ def _run(self, *module_args, **complex_args):

if HAS_CUSTOM_LOADER_SUPPORT:
# Load the collection finder, unsupported, may change in future
init_plugin_loader(ansible.constants.COLLECTIONS_PATHS)
init_plugin_loader(COLLECTIONS_PATHS)

# now create a task queue manager to execute the play
tqm = None
Expand Down
1 change: 1 addition & 0 deletions src/pytest_ansible/module_dispatcher/v24.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def _run(self, *module_args, **complex_args):
"Specified hosts and/or --limit does not match any hosts",
)

# pylint: disable=no-member
parser = CLI.base_parser(
runas_opts=True,
inventory_opts=True,
Expand Down
2 changes: 1 addition & 1 deletion src/pytest_ansible/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from pytest_ansible.host_manager import get_host_manager

# Silence linters for imported fixtures
# pylint: disable=pointless-statement
# pylint: disable=pointless-statement, no-member
(ansible_adhoc, ansible_module, ansible_facts, localhost)


Expand Down

0 comments on commit 155c16a

Please sign in to comment.