Skip to content

Commit

Permalink
chore: auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Nov 4, 2024
1 parent a5fc4f5 commit ef7ffc8
Show file tree
Hide file tree
Showing 37 changed files with 106 additions and 106 deletions.
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def _no_color(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.delitem(os.environ, "FORCE_COLOR", raising=False)


@pytest.fixture()
@pytest.fixture
def resources_folder_path() -> Path:
"""Return the path to the resources folder.
Expand Down Expand Up @@ -127,7 +127,7 @@ def reset_pytest_vars(monkeypatch): # type: ignore[no-untyped-def] # noqa: ANN
monkeypatch.delenv(var_name, raising=False)


@pytest.fixture()
@pytest.fixture
def test_fixture_dir(request: pytest.FixtureRequest) -> Path:
"""Provide the fixture directory for a given test.
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class ParamDefault(TypedDict):
}


@pytest.mark.extensive()
@pytest.mark.extensive
@pytest.mark.parametrize(**PARAMS_DEFAULT)
@pytest.mark.usefixtures("with_scenario")
@pytest.mark.parametrize(
Expand Down Expand Up @@ -112,7 +112,7 @@ def test_command(
assert "PLAY RECAP" in result.stdout


@pytest.mark.extensive()
@pytest.mark.extensive
@pytest.mark.parametrize(**PARAMS_DEFAULT)
@pytest.mark.usefixtures("with_scenario")
def test_command_idempotence(test_ephemeral_dir_env: dict[str, str], scenario_name: str) -> None:
Expand Down Expand Up @@ -200,7 +200,7 @@ def test_command_list_with_format_plain(
assert result.stdout == "instance default ansible default false false\n"


@pytest.mark.extensive()
@pytest.mark.extensive
@pytest.mark.parametrize(**PARAMS_DEFAULT)
@pytest.mark.usefixtures("with_scenario")
@pytest.mark.parametrize(("platform", "missing"), (("instance", False), ("gonzo", True)))
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/command/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
import pytest


@pytest.fixture()
@pytest.fixture
def command_patched_ansible_create(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201, D103
return mocker.patch("molecule.provisioner.ansible.Ansible.create")


@pytest.fixture()
@pytest.fixture
def command_driver_delegated_section_data(): # type: ignore[no-untyped-def] # noqa: ANN201, D103
x = {
"driver": {
Expand All @@ -42,6 +42,6 @@ def command_driver_delegated_section_data(): # type: ignore[no-untyped-def] #
return x # noqa: RET504


@pytest.fixture()
@pytest.fixture
def command_driver_delegated_managed_section_data(): # type: ignore[no-untyped-def] # noqa: ANN201, D103
return {"driver": {"name": "default", "managed": True}}
2 changes: 1 addition & 1 deletion tests/unit/command/test_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from molecule import config


@pytest.fixture()
@pytest.fixture
def _patched_ansible_check(mocker: MockerFixture) -> MagicMock:
return mocker.patch("molecule.provisioner.ansible.Ansible.check")

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/command/test_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
from molecule.types import ProvisionerData


@pytest.fixture()
@pytest.fixture
def _command_provisioner_section_with_cleanup_data() -> (
dict[Literal["provisioner"], ProvisionerData]
):
return {"provisioner": {"name": "ansible", "playbooks": {"cleanup": "cleanup.yml"}}}


@pytest.fixture()
@pytest.fixture
def _patched_ansible_cleanup(mocker: MockerFixture) -> MagicMock:
return mocker.patch("molecule.provisioner.ansible.Ansible.cleanup")

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/command/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from molecule import config


@pytest.fixture()
@pytest.fixture
def _patched_create_setup(mocker: MockerFixture) -> MagicMock:
return mocker.patch("molecule.command.create.Create._setup")

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/command/test_destroy.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
from molecule import config


@pytest.fixture()
@pytest.fixture
def _patched_ansible_destroy(mocker: MockerFixture) -> MagicMock:
return mocker.patch("molecule.provisioner.ansible.Ansible.destroy")


@pytest.fixture()
@pytest.fixture
def _patched_destroy_setup(mocker: MockerFixture) -> MagicMock:
return mocker.patch("molecule.command.destroy.Destroy._setup")

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/command/test_idempotence.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@
from molecule import config


@pytest.fixture()
@pytest.fixture
def _patched_is_idempotent(mocker: MockerFixture) -> Mock:
return mocker.patch("molecule.command.idempotence.Idempotence._is_idempotent")


# NOTE(retr0h): The use of the `patched_config_validate` fixture, disables
# config.Config._validate from executing. Thus preventing odd side-effects
# throughout patched.assert_called unit tests.
@pytest.fixture()
@pytest.fixture
def _instance(patched_config_validate, config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, ARG001
config_instance.state.change_state("converged", True) # noqa: FBT003

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/command/test_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from molecule import config


@pytest.fixture()
@pytest.fixture
def _instance(config_instance: config.Config) -> login.Login:
config_instance.state.change_state("created", value=True)

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/command/test_prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from pytest_mock import MockerFixture


@pytest.fixture()
@pytest.fixture
def _patched_ansible_prepare(mocker: MockerFixture) -> MagicMock:
return mocker.patch("molecule.provisioner.ansible.Ansible.prepare")

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/command/test_side_effect.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from molecule.types import ProvisionerData


@pytest.fixture()
@pytest.fixture
def _command_provisioner_section_with_side_effect_data() -> (
dict[Literal["provisioner"], ProvisionerData]
):
Expand All @@ -50,7 +50,7 @@ def _command_provisioner_section_with_side_effect_data() -> (
}


@pytest.fixture()
@pytest.fixture
def _patched_ansible_side_effect(mocker: MockerFixture) -> MagicMock:
return mocker.patch("molecule.provisioner.ansible.Ansible.side_effect")

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/command/test_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from molecule import config


@pytest.fixture()
@pytest.fixture
def _patched_ansible_syntax(mocker: MockerFixture) -> MagicMock:
return mocker.patch("molecule.provisioner.ansible.Ansible.syntax")

Expand Down
24 changes: 12 additions & 12 deletions tests/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def fixture_molecule_data() -> dict[str, Any]:
}


@pytest.fixture()
@pytest.fixture
def config_instance(
monkeypatch: pytest.MonkeyPatch,
molecule_data: dict[str, Any],
Expand Down Expand Up @@ -121,27 +121,27 @@ def _filter_ignored_scenarios(scenario_paths: list[str]) -> list[str]:
# Mocks


@pytest.fixture()
@pytest.fixture
def patched_print_debug(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201, D103
return mocker.patch("molecule.util.print_debug")


@pytest.fixture()
@pytest.fixture
def patched_logger_info(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201, D103
return mocker.patch("logging.Logger.info")


@pytest.fixture()
@pytest.fixture
def patched_logger_debug(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201, D103
return mocker.patch("logging.Logger.debug")


@pytest.fixture()
@pytest.fixture
def patched_logger_error(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201, D103
return mocker.patch("logging.Logger.error")


@pytest.fixture()
@pytest.fixture
def patched_run_command(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201, D103
m = mocker.patch("molecule.util.run_command")
m.return_value = CompletedProcess(
Expand All @@ -154,36 +154,36 @@ def patched_run_command(mocker): # type: ignore[no-untyped-def] # noqa: ANN001
return m


@pytest.fixture()
@pytest.fixture
def patched_ansible_converge(mocker: MockerFixture) -> Mock: # noqa: D103
m = mocker.patch("molecule.provisioner.ansible.Ansible.converge")
m.return_value = "patched-ansible-converge-stdout"

return m


@pytest.fixture()
@pytest.fixture
def patched_add_or_update_vars(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201, D103
return mocker.patch("molecule.provisioner.ansible.Ansible._add_or_update_vars")


@pytest.fixture()
@pytest.fixture
def patched_ansible_galaxy(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201, D103
return mocker.patch("molecule.dependency.ansible_galaxy.AnsibleGalaxy.execute")


@pytest.fixture()
@pytest.fixture
def patched_default_verifier(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201, D103
return mocker.patch("molecule.verifier.ansible.Ansible.execute")


@pytest.fixture()
@pytest.fixture
def patched_scenario_setup(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201, D103
mocker.patch("molecule.config.Config.env")

return mocker.patch("molecule.scenario.Scenario._setup")


@pytest.fixture()
@pytest.fixture
def patched_config_validate(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201, D103
return mocker.patch("molecule.config.Config._validate")
6 changes: 3 additions & 3 deletions tests/unit/dependency/ansible_galaxy/test_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from molecule.dependency.ansible_galaxy import collections


@pytest.fixture()
@pytest.fixture
def _patched_ansible_galaxy_has_requirements_file(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202
m = mocker.patch(
"molecule.dependency.ansible_galaxy.collections.Collections._has_requirements_file",
Expand All @@ -37,7 +37,7 @@ def _patched_ansible_galaxy_has_requirements_file(mocker): # type: ignore[no-un
return m


@pytest.fixture()
@pytest.fixture
def _dependency_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202
return {
"dependency": {
Expand All @@ -51,7 +51,7 @@ def _dependency_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202
# NOTE(retr0h): The use of the `patched_config_validate` fixture, disables
# config.Config._validate from executing. Thus preventing odd side-effects
# throughout patched.assert_called unit tests.
@pytest.fixture()
@pytest.fixture
def _instance( # type: ignore[no-untyped-def] # noqa: ANN202
_dependency_section_data, # noqa: ANN001
patched_config_validate, # noqa: ANN001, ARG001
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/dependency/ansible_galaxy/test_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from molecule.dependency.ansible_galaxy import roles


@pytest.fixture()
@pytest.fixture
def _patched_ansible_galaxy_has_requirements_file(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202
m = mocker.patch(
"molecule.dependency.ansible_galaxy.roles.Roles._has_requirements_file",
Expand All @@ -37,7 +37,7 @@ def _patched_ansible_galaxy_has_requirements_file(mocker): # type: ignore[no-un
return m


@pytest.fixture()
@pytest.fixture
def _dependency_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202
return {
"dependency": {
Expand All @@ -51,7 +51,7 @@ def _dependency_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202
# NOTE(retr0h): The use of the `patched_config_validate` fixture, disables
# config.Config._validate from executing. Thus preventing odd side-effects
# throughout patched.assert_called unit tests.
@pytest.fixture()
@pytest.fixture
def _instance( # type: ignore[no-untyped-def] # noqa: ANN202
_dependency_section_data, # noqa: ANN001
patched_config_validate, # noqa: ANN001, ARG001
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/dependency/test_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from molecule.dependency import shell


@pytest.fixture()
@pytest.fixture
def _dependency_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202
return {
"dependency": {
Expand All @@ -40,7 +40,7 @@ def _dependency_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202
# NOTE(retr0h): The use of the `patched_config_validate` fixture, disables
# config.Config._validate from executing. Thus preventing odd side-effects
# throughout patched.assert_called unit tests.
@pytest.fixture()
@pytest.fixture
def _instance( # type: ignore[no-untyped-def] # noqa: ANN202
_dependency_section_data, # noqa: ANN001
patched_config_validate, # noqa: ANN001, ARG001
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/driver/test_delegated.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from pytest_mock import MockerFixture


@pytest.fixture()
@pytest.fixture
def _driver_managed_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202
return {
"driver": {
Expand All @@ -46,7 +46,7 @@ def _driver_managed_section_data(): # type: ignore[no-untyped-def] # noqa: ANN
}


@pytest.fixture()
@pytest.fixture
def _driver_unmanaged_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202
return {
"driver": {
Expand All @@ -58,7 +58,7 @@ def _driver_unmanaged_section_data(): # type: ignore[no-untyped-def] # noqa: A
}


@pytest.fixture()
@pytest.fixture
def _instance(config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN202
return delegated.Delegated(config_instance)

Expand Down Expand Up @@ -340,7 +340,7 @@ def test_delegated_created(_instance): # type: ignore[no-untyped-def] # noqa:
assert _instance._created() == "false"


@pytest.fixture()
@pytest.fixture
def _driver_options_managed_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202
return {"driver": {"options": {"managed": False}}}

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/model/v2/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def fixture_molecule_file(resources_folder_path: Path) -> Path:
return resources_folder_path / "molecule.yml"


@pytest.fixture()
@pytest.fixture
def config(molecule_file: Path, request: pytest.FixtureRequest) -> dict[str, Any]:
"""Return merged molecule file data.
Expand All @@ -68,7 +68,7 @@ def config(molecule_file: Path, request: pytest.FixtureRequest) -> dict[str, Any
return d # type: ignore[no-any-return]


@pytest.fixture()
@pytest.fixture
def _model_platforms_delegated_section_data() -> str:
return """
---
Expand Down
Loading

0 comments on commit ef7ffc8

Please sign in to comment.