diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e0c1ac9e3..9d02233c5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -59,14 +59,14 @@ repos: - id: tox-ini-fmt - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.6 + rev: v0.6.3 hooks: - id: ruff args: - --exit-non-zero-on-fix - repo: https://github.com/streetsidesoftware/cspell-cli - rev: v8.13.1 + rev: v8.13.3 hooks: - id: cspell name: Spell check with cspell @@ -80,7 +80,7 @@ repos: pass_filenames: false - repo: https://github.com/pycqa/pylint.git - rev: v3.2.6 + rev: v3.2.7 hooks: - id: pylint args: @@ -98,7 +98,7 @@ repos: - wcmatch - repo: https://github.com/pre-commit/mirrors-mypy.git - rev: v1.11.1 + rev: v1.11.2 hooks: - id: mypy additional_dependencies: diff --git a/tests/conftest.py b/tests/conftest.py index 6af1b59a1..ccea46c65 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -105,7 +105,7 @@ def pytest_collection_modifyitems(items, config): # type: ignore[no-untyped-def @pytest.fixture(autouse=True) -def reset_pytest_vars(monkeypatch): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201, PT004 +def reset_pytest_vars(monkeypatch): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201 """Make PYTEST_* env vars inaccessible to subprocesses.""" for var_name in tuple(os.environ): if var_name.startswith("PYTEST_"): diff --git a/tests/unit/command/test_check.py b/tests/unit/command/test_check.py index 812395538..1613db70a 100644 --- a/tests/unit/command/test_check.py +++ b/tests/unit/command/test_check.py @@ -33,7 +33,7 @@ @pytest.fixture() -def _patched_ansible_check(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005 +def _patched_ansible_check(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202 return mocker.patch("molecule.provisioner.ansible.Ansible.check") diff --git a/tests/unit/command/test_cleanup.py b/tests/unit/command/test_cleanup.py index 9c062066b..b45718c72 100644 --- a/tests/unit/command/test_cleanup.py +++ b/tests/unit/command/test_cleanup.py @@ -34,12 +34,12 @@ @pytest.fixture() -def _command_provisioner_section_with_cleanup_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _command_provisioner_section_with_cleanup_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return {"provisioner": {"name": "ansible", "playbooks": {"cleanup": "cleanup.yml"}}} @pytest.fixture() -def _patched_ansible_cleanup(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005 +def _patched_ansible_cleanup(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202 return mocker.patch("molecule.provisioner.ansible.Ansible.cleanup") diff --git a/tests/unit/command/test_create.py b/tests/unit/command/test_create.py index ca25685a6..23e8997d0 100644 --- a/tests/unit/command/test_create.py +++ b/tests/unit/command/test_create.py @@ -33,7 +33,7 @@ @pytest.fixture() -def _patched_create_setup(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005 +def _patched_create_setup(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202 return mocker.patch("molecule.command.create.Create._setup") diff --git a/tests/unit/command/test_destroy.py b/tests/unit/command/test_destroy.py index 53f37c9c5..daa1e832e 100644 --- a/tests/unit/command/test_destroy.py +++ b/tests/unit/command/test_destroy.py @@ -33,12 +33,12 @@ @pytest.fixture() -def _patched_ansible_destroy(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005 +def _patched_ansible_destroy(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202 return mocker.patch("molecule.provisioner.ansible.Ansible.destroy") @pytest.fixture() -def _patched_destroy_setup(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005 +def _patched_destroy_setup(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202 return mocker.patch("molecule.command.destroy.Destroy._setup") diff --git a/tests/unit/command/test_idempotence.py b/tests/unit/command/test_idempotence.py index fbb7aab21..6a5a94744 100644 --- a/tests/unit/command/test_idempotence.py +++ b/tests/unit/command/test_idempotence.py @@ -35,7 +35,7 @@ @pytest.fixture() -def _patched_is_idempotent(mocker: MockerFixture) -> Mock: # noqa: PT005 +def _patched_is_idempotent(mocker: MockerFixture) -> Mock: return mocker.patch("molecule.command.idempotence.Idempotence._is_idempotent") @@ -43,7 +43,7 @@ def _patched_is_idempotent(mocker: MockerFixture) -> Mock: # noqa: PT005 # config.Config._validate from executing. Thus preventing odd side-effects # throughout patched.assert_called unit tests. @pytest.fixture() -def _instance(patched_config_validate, config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005, ARG001 +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 return idempotence.Idempotence(config_instance) diff --git a/tests/unit/command/test_login.py b/tests/unit/command/test_login.py index 742798ed3..4fc4707a2 100644 --- a/tests/unit/command/test_login.py +++ b/tests/unit/command/test_login.py @@ -33,7 +33,7 @@ @pytest.fixture() -def _instance(config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _instance(config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN202 config_instance.state.change_state("created", True) # noqa: FBT003 return login.Login(config_instance) diff --git a/tests/unit/command/test_prepare.py b/tests/unit/command/test_prepare.py index 33def3773..bba821be6 100644 --- a/tests/unit/command/test_prepare.py +++ b/tests/unit/command/test_prepare.py @@ -34,7 +34,7 @@ @pytest.fixture() -def _patched_ansible_prepare(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005 +def _patched_ansible_prepare(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202 return mocker.patch("molecule.provisioner.ansible.Ansible.prepare") diff --git a/tests/unit/command/test_side_effect.py b/tests/unit/command/test_side_effect.py index 699554823..2b3a908aa 100644 --- a/tests/unit/command/test_side_effect.py +++ b/tests/unit/command/test_side_effect.py @@ -34,7 +34,7 @@ @pytest.fixture() -def _command_provisioner_section_with_side_effect_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _command_provisioner_section_with_side_effect_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return { "provisioner": { "name": "ansible", @@ -44,7 +44,7 @@ def _command_provisioner_section_with_side_effect_data(): # type: ignore[no-unt @pytest.fixture() -def _patched_ansible_side_effect(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005 +def _patched_ansible_side_effect(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202 return mocker.patch("molecule.provisioner.ansible.Ansible.side_effect") diff --git a/tests/unit/command/test_syntax.py b/tests/unit/command/test_syntax.py index 5b1660e5b..38a61a9e2 100644 --- a/tests/unit/command/test_syntax.py +++ b/tests/unit/command/test_syntax.py @@ -33,7 +33,7 @@ @pytest.fixture() -def _patched_ansible_syntax(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005 +def _patched_ansible_syntax(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202 return mocker.patch("molecule.provisioner.ansible.Ansible.syntax") diff --git a/tests/unit/dependency/ansible_galaxy/test_collections.py b/tests/unit/dependency/ansible_galaxy/test_collections.py index db1c37d09..282a6ec08 100644 --- a/tests/unit/dependency/ansible_galaxy/test_collections.py +++ b/tests/unit/dependency/ansible_galaxy/test_collections.py @@ -28,7 +28,7 @@ @pytest.fixture() -def _patched_ansible_galaxy_has_requirements_file(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005 +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", ) @@ -38,7 +38,7 @@ def _patched_ansible_galaxy_has_requirements_file(mocker): # type: ignore[no-un @pytest.fixture() -def _dependency_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _dependency_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return { "dependency": { "name": "galaxy", @@ -52,7 +52,7 @@ def _dependency_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, # config.Config._validate from executing. Thus preventing odd side-effects # throughout patched.assert_called unit tests. @pytest.fixture() -def _instance( # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _instance( # type: ignore[no-untyped-def] # noqa: ANN202 _dependency_section_data, # noqa: ANN001 patched_config_validate, # noqa: ANN001, ARG001 config_instance: config.Config, diff --git a/tests/unit/dependency/ansible_galaxy/test_roles.py b/tests/unit/dependency/ansible_galaxy/test_roles.py index 6897caa99..f902b1289 100644 --- a/tests/unit/dependency/ansible_galaxy/test_roles.py +++ b/tests/unit/dependency/ansible_galaxy/test_roles.py @@ -28,7 +28,7 @@ @pytest.fixture() -def _patched_ansible_galaxy_has_requirements_file(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005 +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", ) @@ -38,7 +38,7 @@ def _patched_ansible_galaxy_has_requirements_file(mocker): # type: ignore[no-un @pytest.fixture() -def _dependency_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _dependency_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return { "dependency": { "name": "galaxy", @@ -52,7 +52,7 @@ def _dependency_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, # config.Config._validate from executing. Thus preventing odd side-effects # throughout patched.assert_called unit tests. @pytest.fixture() -def _instance( # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _instance( # type: ignore[no-untyped-def] # noqa: ANN202 _dependency_section_data, # noqa: ANN001 patched_config_validate, # noqa: ANN001, ARG001 config_instance: config.Config, diff --git a/tests/unit/dependency/test_shell.py b/tests/unit/dependency/test_shell.py index dd10b480a..76fd53763 100644 --- a/tests/unit/dependency/test_shell.py +++ b/tests/unit/dependency/test_shell.py @@ -26,7 +26,7 @@ @pytest.fixture() -def _dependency_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _dependency_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return { "dependency": { "name": "shell", @@ -41,7 +41,7 @@ def _dependency_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, # config.Config._validate from executing. Thus preventing odd side-effects # throughout patched.assert_called unit tests. @pytest.fixture() -def _instance( # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _instance( # type: ignore[no-untyped-def] # noqa: ANN202 _dependency_section_data, # noqa: ANN001 patched_config_validate, # noqa: ANN001, ARG001 config_instance: config.Config, diff --git a/tests/unit/driver/test_delegated.py b/tests/unit/driver/test_delegated.py index f2ba672f8..241d69551 100644 --- a/tests/unit/driver/test_delegated.py +++ b/tests/unit/driver/test_delegated.py @@ -35,7 +35,7 @@ @pytest.fixture() -def _driver_managed_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _driver_managed_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return { "driver": { "name": "default", @@ -47,7 +47,7 @@ def _driver_managed_section_data(): # type: ignore[no-untyped-def] # noqa: ANN @pytest.fixture() -def _driver_unmanaged_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _driver_unmanaged_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return { "driver": { "name": "default", @@ -59,7 +59,7 @@ def _driver_unmanaged_section_data(): # type: ignore[no-untyped-def] # noqa: A @pytest.fixture() -def _instance(config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _instance(config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN202 return delegated.Delegated(config_instance) @@ -342,7 +342,7 @@ def test_delegated_created(_instance): # type: ignore[no-untyped-def] # noqa: @pytest.fixture() -def _driver_options_managed_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _driver_options_managed_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return {"driver": {"options": {"managed": False}}} diff --git a/tests/unit/model/v2/conftest.py b/tests/unit/model/v2/conftest.py index 2ffd71bba..34e428c83 100644 --- a/tests/unit/model/v2/conftest.py +++ b/tests/unit/model/v2/conftest.py @@ -68,7 +68,7 @@ def config(molecule_file: Path, request: pytest.FixtureRequest) -> dict[str, Any @pytest.fixture() -def _model_platforms_delegated_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _model_platforms_delegated_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return """ --- platforms: diff --git a/tests/unit/model/v2/test_dependency_section.py b/tests/unit/model/v2/test_dependency_section.py index 006a01757..35b41dc76 100644 --- a/tests/unit/model/v2/test_dependency_section.py +++ b/tests/unit/model/v2/test_dependency_section.py @@ -25,7 +25,7 @@ @pytest.fixture() -def _model_dependency_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _model_dependency_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return { "dependency": { "name": "galaxy", @@ -46,7 +46,7 @@ def test_dependency(config): # type: ignore[no-untyped-def] # noqa: ANN001, AN @pytest.fixture() -def _model_dependency_errors_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _model_dependency_errors_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return {"dependency": {"name": 0}} @@ -62,12 +62,12 @@ def test_dependency_has_errors(config): # type: ignore[no-untyped-def] # noqa: @pytest.fixture() -def _model_dependency_allows_galaxy_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _model_dependency_allows_galaxy_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return {"dependency": {"name": "galaxy"}} @pytest.fixture() -def _model_dependency_allows_shell_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _model_dependency_allows_shell_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return {"dependency": {"name": "shell"}} @@ -84,7 +84,7 @@ def test_dependency_allows_shell_name(config): # type: ignore[no-untyped-def] @pytest.fixture() -def _model_dependency_shell_errors_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _model_dependency_shell_errors_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return {"dependency": {"name": "shell", "command": None}} diff --git a/tests/unit/model/v2/test_driver_section.py b/tests/unit/model/v2/test_driver_section.py index a350b4db7..46e00c99f 100644 --- a/tests/unit/model/v2/test_driver_section.py +++ b/tests/unit/model/v2/test_driver_section.py @@ -25,7 +25,7 @@ @pytest.fixture() -def _model_driver_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _model_driver_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return { "driver": { "name": "default", @@ -43,7 +43,7 @@ def test_driver(config): # type: ignore[no-untyped-def] # noqa: ANN001, ANN201 @pytest.fixture() -def _model_driver_errors_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _model_driver_errors_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return { "driver": { "name": 0, @@ -52,7 +52,7 @@ def _model_driver_errors_section_data(): # type: ignore[no-untyped-def] # noqa @pytest.fixture() -def _model_driver_errors_section_data_no_prefix(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _model_driver_errors_section_data_no_prefix(): # type: ignore[no-untyped-def] # noqa: ANN202 return { "driver": { "name": "random_name", @@ -81,7 +81,7 @@ def test_driver_has_errors(config): # type: ignore[no-untyped-def] # noqa: ANN @pytest.fixture() -def _model_driver_provider_name_nullable_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _model_driver_provider_name_nullable_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return {"driver": {"provider": {"name": None}}} @@ -95,27 +95,27 @@ def test_driver_provider_name_nullable(config): # type: ignore[no-untyped-def] @pytest.fixture() -def _model_driver_allows_delegated_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _model_driver_allows_delegated_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return {"driver": {"name": "default"}} @pytest.fixture() -def _model_driver_allows_molecule_section_data1(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _model_driver_allows_molecule_section_data1(): # type: ignore[no-untyped-def] # noqa: ANN202 return {"driver": {"name": "molecule-test_driver.name"}} @pytest.fixture() -def _model_driver_allows_molecule_section_data2(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _model_driver_allows_molecule_section_data2(): # type: ignore[no-untyped-def] # noqa: ANN202 return {"driver": {"name": "molecule_test_driver.name"}} @pytest.fixture() -def _model_driver_allows_custom_section_data1(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _model_driver_allows_custom_section_data1(): # type: ignore[no-untyped-def] # noqa: ANN202 return {"driver": {"name": "custom-test_driver.name"}} @pytest.fixture() -def _model_driver_allows_custom_section_data2(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _model_driver_allows_custom_section_data2(): # type: ignore[no-untyped-def] # noqa: ANN202 return {"driver": {"name": "custom_test_driver.name"}} diff --git a/tests/unit/model/v2/test_provisioner_section.py b/tests/unit/model/v2/test_provisioner_section.py index 548e49e5b..a60a874e8 100644 --- a/tests/unit/model/v2/test_provisioner_section.py +++ b/tests/unit/model/v2/test_provisioner_section.py @@ -25,7 +25,7 @@ @pytest.fixture() -def _model_provisioner_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _model_provisioner_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return { "provisioner": { "name": "ansible", @@ -63,7 +63,7 @@ def test_provisioner(config): # type: ignore[no-untyped-def] # noqa: ANN001, A @pytest.fixture() -def _model_provisioner_errors_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _model_provisioner_errors_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return { "provisioner": { "name": 0, @@ -83,7 +83,7 @@ def test_provisioner_has_errors(config): # type: ignore[no-untyped-def] # noqa @pytest.fixture() -def _model_provisioner_allows_ansible_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _model_provisioner_allows_ansible_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return {"provisioner": {"name": "ansible"}} diff --git a/tests/unit/model/v2/test_scenario_section.py b/tests/unit/model/v2/test_scenario_section.py index 6e2279538..6e3ed8afb 100644 --- a/tests/unit/model/v2/test_scenario_section.py +++ b/tests/unit/model/v2/test_scenario_section.py @@ -25,7 +25,7 @@ @pytest.fixture() -def _model_scenario_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _model_scenario_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return { "scenario": { "name": "foo", @@ -44,7 +44,7 @@ def test_scenario(config): # type: ignore[no-untyped-def] # noqa: ANN001, ANN2 @pytest.fixture() -def _model_scenario_errors_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _model_scenario_errors_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return {"scenario": {"name": 0}} diff --git a/tests/unit/model/v2/test_verifier_section.py b/tests/unit/model/v2/test_verifier_section.py index 4f8821a86..b4015bc74 100644 --- a/tests/unit/model/v2/test_verifier_section.py +++ b/tests/unit/model/v2/test_verifier_section.py @@ -25,7 +25,7 @@ @pytest.fixture() -def _model_verifier_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _model_verifier_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return { "verifier": { "name": "testinfra", @@ -44,7 +44,7 @@ def test_verifier(config): # type: ignore[no-untyped-def] # noqa: ANN001, ANN2 @pytest.fixture() -def _model_verifier_errors_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _model_verifier_errors_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return { "verifier": { "name": 0, @@ -64,12 +64,12 @@ def test_verifier_has_errors(config): # type: ignore[no-untyped-def] # noqa: A @pytest.fixture() -def _model_verifier_allows_testinfra_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _model_verifier_allows_testinfra_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return {"verifier": {"name": "testinfra"}} @pytest.fixture() -def _model_verifier_allows_ansible_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _model_verifier_allows_ansible_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return {"verifier": {"name": "ansible"}} diff --git a/tests/unit/provisioner/test_ansible.py b/tests/unit/provisioner/test_ansible.py index 4f65af179..1868372bc 100644 --- a/tests/unit/provisioner/test_ansible.py +++ b/tests/unit/provisioner/test_ansible.py @@ -38,7 +38,7 @@ @pytest.fixture() -def _patched_ansible_playbook(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005 +def _patched_ansible_playbook(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202 m = mocker.patch("molecule.provisioner.ansible_playbook.AnsiblePlaybook") m.return_value.execute.return_value = b"patched-ansible-playbook-stdout" @@ -46,22 +46,22 @@ def _patched_ansible_playbook(mocker): # type: ignore[no-untyped-def] # noqa: @pytest.fixture() -def _patched_write_inventory(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005 +def _patched_write_inventory(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202 return mocker.patch("molecule.provisioner.ansible.Ansible._write_inventory") @pytest.fixture() -def _patched_remove_vars(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005 +def _patched_remove_vars(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202 return mocker.patch("molecule.provisioner.ansible.Ansible._remove_vars") @pytest.fixture() -def _patched_link_or_update_vars(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005 +def _patched_link_or_update_vars(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202 return mocker.patch("molecule.provisioner.ansible.Ansible._link_or_update_vars") @pytest.fixture() -def _provisioner_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _provisioner_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return { "provisioner": { "name": "ansible", diff --git a/tests/unit/provisioner/test_ansible_playbook.py b/tests/unit/provisioner/test_ansible_playbook.py index 58575c27b..427d239f9 100644 --- a/tests/unit/provisioner/test_ansible_playbook.py +++ b/tests/unit/provisioner/test_ansible_playbook.py @@ -28,24 +28,24 @@ @pytest.fixture() -def _instance(config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _instance(config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN202 _instance = ansible_playbook.AnsiblePlaybook("playbook", config_instance) return _instance # noqa: RET504 @pytest.fixture() -def _provisioner_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _provisioner_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return {"provisioner": {"name": "ansible", "env": {"FOO": "bar"}}} @pytest.fixture() -def _verifier_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _verifier_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return {"verifier": {"name": "ansible", "env": {"FOO": "bar"}}} @pytest.fixture() -def _provisioner_verifier_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _provisioner_verifier_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return { "provisioner": {"name": "ansible", "env": {"FOO": "bar"}}, "verifier": {"name": "ansible", "env": {"FOO": "baz"}}, @@ -53,7 +53,7 @@ def _provisioner_verifier_section_data(): # type: ignore[no-untyped-def] # noq @pytest.fixture() -def _instance_for_verifier_env(config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _instance_for_verifier_env(config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN202 _instance = ansible_playbook.AnsiblePlaybook("playbook", config_instance, True) # noqa: FBT003 return _instance # noqa: RET504 @@ -86,7 +86,7 @@ def test_env_in_verify_override_provision(_instance_for_verifier_env): # type: @pytest.fixture() -def _inventory_directory(_instance): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005 +def _inventory_directory(_instance): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202 return _instance._config.provisioner.inventory_directory diff --git a/tests/unit/provisioner/test_ansible_playbooks.py b/tests/unit/provisioner/test_ansible_playbooks.py index 697c19986..72c35999c 100644 --- a/tests/unit/provisioner/test_ansible_playbooks.py +++ b/tests/unit/provisioner/test_ansible_playbooks.py @@ -29,12 +29,12 @@ @pytest.fixture() -def _provisioner_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _provisioner_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return {"provisioner": {"name": "ansible", "options": {}, "config_options": {}}} @pytest.fixture() -def _instance(_provisioner_section_data, config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005 +def _instance(_provisioner_section_data, config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202 return ansible_playbooks.AnsiblePlaybooks(config_instance) @@ -100,7 +100,7 @@ def test_get_playbook_returns_bundled_driver_playbook_when_local_not_found( # t @pytest.fixture() -def _provisioner_driver_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _provisioner_driver_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return { "provisioner": { "name": "ansible", @@ -112,7 +112,7 @@ def _provisioner_driver_section_data(): # type: ignore[no-untyped-def] # noqa: @pytest.fixture() -def _provisioner_driver_playbook_key_missing_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _provisioner_driver_playbook_key_missing_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return { "provisioner": { "name": "ansible", diff --git a/tests/unit/test_config.py b/tests/unit/test_config.py index 0638b5368..75440234e 100644 --- a/tests/unit/test_config.py +++ b/tests/unit/test_config.py @@ -91,7 +91,7 @@ def test_dependency_property(config_instance: config.Config): # type: ignore[no @pytest.fixture() -def _config_dependency_shell_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _config_dependency_shell_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return {"dependency": {"name": "shell", "command": "bin/command"}} @@ -105,7 +105,7 @@ def test_dependency_property_is_shell(config_instance: config.Config): # type: @pytest.fixture() -def _config_driver_delegated_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _config_driver_delegated_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return {"driver": {"name": "default", "options": {"managed": False}}} diff --git a/tests/unit/test_interpolation.py b/tests/unit/test_interpolation.py index 547b71718..520d99468 100644 --- a/tests/unit/test_interpolation.py +++ b/tests/unit/test_interpolation.py @@ -19,7 +19,7 @@ @pytest.fixture() -def _mock_env(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _mock_env(): # type: ignore[no-untyped-def] # noqa: ANN202 return { "FOO": "foo", "BAR": "", @@ -30,7 +30,7 @@ def _mock_env(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 @pytest.fixture() -def _instance(_mock_env): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005 +def _instance(_mock_env): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202 return interpolation.Interpolator(interpolation.TemplateWithDefaults, _mock_env) diff --git a/tests/unit/test_logger.py b/tests/unit/test_logger.py index af17aa359..1a870aea5 100644 --- a/tests/unit/test_logger.py +++ b/tests/unit/test_logger.py @@ -43,19 +43,19 @@ def execute(self, action_args=None): # type: ignore[no-untyped-def] # noqa: AN @pytest.fixture() -def _dummy_class(patched_config_validate, config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005, ARG001 +def _dummy_class(patched_config_validate, config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, ARG001 return Dummy @pytest.fixture() -def _instance(_dummy_class, config_instance, _patched_logger_env): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005 +def _instance(_dummy_class, config_instance, _patched_logger_env): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202 # _patched_logger_env included here to ensure pytest runs it first get_section_loggers.cache_clear() return _dummy_class(config_instance) @pytest.fixture() -def _patched_logger_env(request, monkeypatch): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005 +def _patched_logger_env(request, monkeypatch): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202 """Parametrize tests with and without CI env vars.""" envvars = {"CI": None, "GITHUB_ACTIONS": None, "GITLAB_CI": None, "TRAVIS": None} envvars.update(request.param[1]) diff --git a/tests/unit/test_platforms.py b/tests/unit/test_platforms.py index cd5725159..4bf41b3ba 100644 --- a/tests/unit/test_platforms.py +++ b/tests/unit/test_platforms.py @@ -25,7 +25,7 @@ @pytest.fixture() -def _instance(config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _instance(config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN202 return platforms.Platforms(config_instance) diff --git a/tests/unit/test_scenario.py b/tests/unit/test_scenario.py index fee74a53e..55c922aa8 100644 --- a/tests/unit/test_scenario.py +++ b/tests/unit/test_scenario.py @@ -33,7 +33,7 @@ # config.Config._validate from executing. Thus preventing odd side-effects # throughout patched.assert_called unit tests. @pytest.fixture() -def _instance(patched_config_validate, config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005, ARG001 +def _instance(patched_config_validate, config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, ARG001 return scenario.Scenario(config_instance) diff --git a/tests/unit/test_scenarios.py b/tests/unit/test_scenarios.py index 6323dbed3..d8d26e8c9 100644 --- a/tests/unit/test_scenarios.py +++ b/tests/unit/test_scenarios.py @@ -29,7 +29,7 @@ @pytest.fixture() -def _instance(config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _instance(config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN202 config_instance_1 = copy.deepcopy(config_instance) config_instance_2 = copy.deepcopy(config_instance) diff --git a/tests/unit/test_scenarios_ordered.py b/tests/unit/test_scenarios_ordered.py index eca9fc417..cf217db52 100644 --- a/tests/unit/test_scenarios_ordered.py +++ b/tests/unit/test_scenarios_ordered.py @@ -27,7 +27,7 @@ @pytest.fixture() -def _instance(config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _instance(config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN202 config_instance_1 = copy.deepcopy(config_instance) config_instance_1.config["scenario"]["name"] = "two" config_instance_1.molecule_file = config_instance_1.molecule_file.replace( diff --git a/tests/unit/test_state.py b/tests/unit/test_state.py index e0a0fe69a..48467f3cd 100644 --- a/tests/unit/test_state.py +++ b/tests/unit/test_state.py @@ -27,7 +27,7 @@ @pytest.fixture() -def _instance(config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _instance(config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN202 return state.State(config_instance) diff --git a/tests/unit/test_status.py b/tests/unit/test_status.py index d6f413cb7..4bb890d30 100644 --- a/tests/unit/test_status.py +++ b/tests/unit/test_status.py @@ -25,7 +25,7 @@ @pytest.fixture() -def _instance(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _instance(): # type: ignore[no-untyped-def] # noqa: ANN202 s = Status( instance_name=None, # type: ignore[arg-type] driver_name=None, # type: ignore[arg-type] diff --git a/tests/unit/verifier/test_ansible.py b/tests/unit/verifier/test_ansible.py index ee2ba74b8..b58fe4425 100644 --- a/tests/unit/verifier/test_ansible.py +++ b/tests/unit/verifier/test_ansible.py @@ -11,7 +11,7 @@ @pytest.fixture() -def _patched_ansible_verify(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005 +def _patched_ansible_verify(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202 m = mocker.patch("molecule.provisioner.ansible.Ansible.verify") m.return_value = "patched-ansible-verify-stdout" @@ -19,7 +19,7 @@ def _patched_ansible_verify(mocker): # type: ignore[no-untyped-def] # noqa: AN @pytest.fixture() -def _verifier_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _verifier_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return {"verifier": {"name": "ansible", "env": {"FOO": "bar"}}} @@ -27,7 +27,7 @@ def _verifier_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, P # config.Config._validate from executing. Thus preventing odd side-effects # throughout patched.assert_called unit tests. @pytest.fixture() -def _instance( # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _instance( # type: ignore[no-untyped-def] # noqa: ANN202 _verifier_section_data, # noqa: ANN001 patched_config_validate, # noqa: ANN001, ARG001 config_instance: config.Config, diff --git a/tests/unit/verifier/test_testinfra.py b/tests/unit/verifier/test_testinfra.py index 510c3799d..29fb20867 100644 --- a/tests/unit/verifier/test_testinfra.py +++ b/tests/unit/verifier/test_testinfra.py @@ -28,7 +28,7 @@ @pytest.fixture() -def _patched_testinfra_get_tests(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005 +def _patched_testinfra_get_tests(mocker): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202 m = mocker.patch("molecule.verifier.testinfra.Testinfra._get_tests") m.return_value = ["foo.py", "bar.py"] @@ -36,7 +36,7 @@ def _patched_testinfra_get_tests(mocker): # type: ignore[no-untyped-def] # noq @pytest.fixture() -def _verifier_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _verifier_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return { "verifier": { "name": "testinfra", @@ -51,7 +51,7 @@ def _verifier_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, P # config.Config._validate from executing. Thus preventing odd side-effects # throughout patched.assert_called unit tests. @pytest.fixture() -def _instance(patched_config_validate, config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, PT005, ARG001 +def _instance(patched_config_validate, config_instance: config.Config): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202, ARG001 return testinfra.Testinfra(config_instance) @@ -166,7 +166,7 @@ def test_testinfra_directory_property(_instance): # type: ignore[no-untyped-def @pytest.fixture() -def _verifier_testinfra_directory_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202, PT005 +def _verifier_testinfra_directory_section_data(): # type: ignore[no-untyped-def] # noqa: ANN202 return {"verifier": {"name": "testinfra", "directory": "/tmp/foo/bar"}} # noqa: S108