Skip to content

Commit

Permalink
chore: pre-commit autoupdate (#399)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored Nov 5, 2024
1 parent e01ab30 commit 652cd70
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 26 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ repos:
- prettier-plugin-sort-json

- repo: https://github.com/psf/black
rev: 24.8.0
rev: 24.10.0
hooks:
- id: black

Expand All @@ -59,14 +59,14 @@ repos:
- id: tox-ini-fmt

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
rev: v0.7.2
hooks:
- id: ruff
args:
- --exit-non-zero-on-fix

- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v8.13.3
rev: v8.15.2
hooks:
- id: cspell
name: Spell check with cspell
Expand Down Expand Up @@ -94,7 +94,7 @@ repos:
- setuptools

- repo: https://github.com/pre-commit/mirrors-mypy.git
rev: v1.11.2
rev: v1.13.0
hooks:
- id: mypy
additional_dependencies:
Expand Down
4 changes: 2 additions & 2 deletions src/pytest_ansible/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ def fixture_ansible_module(ansible_adhoc): # type: ignore[no-untyped-def] # no
return getattr(host_mgr, host_mgr.options["host_pattern"])


@pytest.fixture()
@pytest.fixture
def ansible_facts(ansible_module): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201
"""Return ansible_facts dictionary."""
return ansible_module.setup()


@pytest.fixture()
@pytest.fixture
def localhost(request): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201
"""Return a host manager representing localhost."""
# NOTE: Do not use ansible_adhoc as a dependent fixture since that will assert specific command-line parameters have # noqa: E501
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,15 @@ def _clear_global_context(): # type: ignore[no-untyped-def] # noqa: ANN202
co.GlobalCLIArgs._Singleton__instance = None


@pytest.fixture()
@pytest.fixture
def option(request, pytester): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201
"""Returns an instance of PyTestOption to help tests pass parameters and
use a common inventory file.
""" # noqa: D205
return PyTestOption(request.config, pytester)


@pytest.fixture()
@pytest.fixture
def hosts(): # type: ignore[no-untyped-def] # noqa: ANN201, D103
def create_host_manager(include_extra_inventory=False): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, FBT002
kwargs = {"inventory": ",".join(ALL_HOSTS), "connection": "local"}
Expand Down
18 changes: 9 additions & 9 deletions tests/test_adhoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
EXIT_NOTESTSCOLLECTED = ExitCode.NO_TESTS_COLLECTED


@pytest.mark.old()
@pytest.mark.old
def test_contacted_with_params(pytester, option): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201
"""FIXME."""
src = """
Expand Down Expand Up @@ -54,7 +54,7 @@ def test_func(ansible_module):
assert result.parseoutcomes()["passed"] == 1


@pytest.mark.old()
@pytest.mark.old
def test_contacted_with_params_and_inventory_marker(pytester, option): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201
"""FIXME."""
src = f"""
Expand All @@ -80,7 +80,7 @@ def test_func(ansible_module):
assert result.parseoutcomes()["passed"] == 1


@pytest.mark.old()
@pytest.mark.old
def test_contacted_with_params_and_host_pattern_marker(pytester, option): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201
"""FIXME."""
src = """
Expand Down Expand Up @@ -111,7 +111,7 @@ def test_func(ansible_module):
assert result.parseoutcomes()["passed"] == 1


@pytest.mark.old()
@pytest.mark.old
def test_contacted_with_params_and_inventory_host_pattern_marker(pytester, option): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201
"""FIXME."""
src = f"""
Expand Down Expand Up @@ -142,7 +142,7 @@ def test_func(ansible_module):
assert result.parseoutcomes()["passed"] == 1


@pytest.mark.old()
@pytest.mark.old
def test_become(pytester, option): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201
"""Test --ansible-become* parameters. This test doesn't actually 'sudo',
but verifies that 'sudo' was attempted by asserting
Expand Down Expand Up @@ -194,7 +194,7 @@ def test_func(ansible_module):
assert result.parseoutcomes()["passed"] == 1


@pytest.mark.old()
@pytest.mark.old
def test_dark_with_params(pytester, option): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201
"""FIXME."""
src = """
Expand Down Expand Up @@ -224,7 +224,7 @@ def test_func(ansible_module):
assert result.parseoutcomes()["passed"] == 1


@pytest.mark.old()
@pytest.mark.old
def test_dark_with_params_and_inventory_marker(pytester, option): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201
"""FIXME."""
src = f"""
Expand All @@ -250,7 +250,7 @@ def test_func(ansible_module):
assert result.parseoutcomes()["passed"] == 1


@pytest.mark.old()
@pytest.mark.old
def test_dark_with_params_and_host_pattern_marker(pytester, option): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201
"""FIXME."""
src = """
Expand Down Expand Up @@ -282,7 +282,7 @@ def test_func(ansible_module):
assert result.parseoutcomes()["passed"] == 1


@pytest.mark.old()
@pytest.mark.old
def test_dark_with_debug_enabled(pytester, option): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201
"""Verify that when verbosity is enabled, additional output is provided upon host failure."""
src = """
Expand Down
4 changes: 2 additions & 2 deletions tests/test_adhoc_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def test_not_getattr(adhoc_result, host_pattern): # type: ignore[no-untyped-def
getattr(adhoc_result_ret, host_pattern)


@pytest.mark.requires_ansible_v2()
@pytest.mark.requires_ansible_v2
def test_connection_failure_v2(): # type: ignore[no-untyped-def] # noqa: ANN201, D103
from pytest_ansible.errors import AnsibleConnectionFailure
from pytest_ansible.host_manager.utils import get_host_manager
Expand All @@ -141,7 +141,7 @@ def test_connection_failure_v2(): # type: ignore[no-untyped-def] # noqa: ANN20
)


@pytest.mark.requires_ansible_v2()
@pytest.mark.requires_ansible_v2
def test_connection_failure_extra_inventory_v2(): # type: ignore[no-untyped-def] # noqa: ANN201, D103
from pytest_ansible.errors import AnsibleConnectionFailure
from pytest_ansible.host_manager.utils import get_host_manager
Expand Down
2 changes: 1 addition & 1 deletion tests/test_module_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_type_error() -> None:
BaseModuleDispatcher(inventory="localhost,") # type: ignore[abstract] #pylint: disable=abstract-class-instantiated


@pytest.mark.requires_ansible_v2()
@pytest.mark.requires_ansible_v2
def test_importerror_requires_v1(): # type: ignore[no-untyped-def] # noqa: ANN201, D103
with pytest.raises(ImportError):
# pylint: disable=unused-import
Expand Down
10 changes: 5 additions & 5 deletions tests/test_module_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
invalid_hosts = ("none", "all", "*", "local*")


@pytest.fixture()
@pytest.fixture
def module_result_ok(request): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201, ARG001, D103
return ModuleResult(
invocation={"module_name": "debug", "module_args": {"msg": "testing"}},
Expand All @@ -39,7 +39,7 @@ def module_result_ok(request): # type: ignore[no-untyped-def] # noqa: ANN001,
)


@pytest.fixture()
@pytest.fixture
def module_result_failed(): # type: ignore[no-untyped-def] # noqa: ANN201, D103
return ModuleResult(
invocation={"module_name": "fail", "module_args": {}},
Expand All @@ -50,7 +50,7 @@ def module_result_failed(): # type: ignore[no-untyped-def] # noqa: ANN201, D10
)


@pytest.fixture()
@pytest.fixture
def module_result_changed(request): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201, ARG001, D103
return ModuleResult(
changed=True,
Expand Down Expand Up @@ -79,13 +79,13 @@ def module_result_changed(request): # type: ignore[no-untyped-def] # noqa: ANN
)


@pytest.fixture()
@pytest.fixture
def _module_result_skipped(): # type: ignore[no-untyped-def] # noqa: ANN202
msg = "Coming soon!"
raise NotImplementedError(msg)


@pytest.fixture()
@pytest.fixture
def _module_result_unreachable(): # type: ignore[no-untyped-def] # noqa: ANN202
msg = "Coming soon!"
raise NotImplementedError(msg)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def test_func(ansible_module):
)


@pytest.mark.requires_ansible_v2()
@pytest.mark.requires_ansible_v2
def test_params_required_without_inventory_with_host_pattern_v2(pytester, option): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201, D103
src = """
import pytest
Expand Down

0 comments on commit 652cd70

Please sign in to comment.