Skip to content

Commit

Permalink
Update dependency ruff to ^0.7.1 (#2633)
Browse files Browse the repository at this point in the history
Co-authored-by: Kyle Finley <kyle@finley.sh>
  • Loading branch information
renovate[bot] and ITProKyle authored Oct 28, 2024
1 parent 148d7a2 commit c77bd15
Show file tree
Hide file tree
Showing 27 changed files with 70 additions and 70 deletions.
40 changes: 20 additions & 20 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ sphinxcontrib-programoutput = "^0.17"

[tool.poetry.group.lint.dependencies]
black = "^24.10.0"
ruff = "^0.6.9"
ruff = "^0.7.1"

[tool.poetry.group.test.dependencies]
coverage = {extras = ["toml"], version = "^7.6.4"}
Expand Down
8 changes: 4 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,20 @@ def pytest_addoption(parser: Parser) -> None:
)


@pytest.fixture()
@pytest.fixture
def cli_runner(request: SubRequest) -> CliRunner:
"""Initialize instance of `click.testing.CliRunner`."""
return cli_runner_factory(request)


@pytest.fixture()
@pytest.fixture
def cli_runner_isolated(cli_runner: CliRunner) -> Generator[CliRunner, None, None]:
"""Initialize instance of `click.testing.CliRunner` with `isolate_filesystem()` called."""
with cli_runner.isolated_filesystem():
yield cli_runner


@pytest.fixture()
@pytest.fixture
def cd_tmp_path(tmp_path: Path) -> Iterator[Path]:
"""Change directory to a temporary path.
Expand All @@ -79,7 +79,7 @@ def cd_tmp_path(tmp_path: Path) -> Iterator[Path]:
os.chdir(prev_dir)


@pytest.fixture()
@pytest.fixture
def root_dir() -> Path:
"""Return a path object to the root directory."""
return Path(__file__).parent.parent
Expand Down
6 changes: 3 additions & 3 deletions tests/functional/terraform/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def fixture_dir() -> Path:
return Path(__file__).parent / "fixtures"


@pytest.fixture()
@pytest.fixture
def local_backend(fixture_dir: Path, request: SubRequest) -> Generator[Path, None, None]:
"""Copy local_backend.tf into the test directory."""
file_name = "local_backend.tf"
Expand All @@ -31,7 +31,7 @@ def local_backend(fixture_dir: Path, request: SubRequest) -> Generator[Path, Non
new_file.unlink()


@pytest.fixture()
@pytest.fixture
def no_backend(fixture_dir: Path, request: SubRequest) -> Generator[Path, None, None]:
"""Copy no_backend.tf into the test directory."""
file_name = "no_backend.tf"
Expand All @@ -42,7 +42,7 @@ def no_backend(fixture_dir: Path, request: SubRequest) -> Generator[Path, None,
new_file.unlink()


@pytest.fixture()
@pytest.fixture
def s3_backend(fixture_dir: Path, request: SubRequest) -> Generator[Path, None, None]:
"""Copy s3_backend.tf into the test directory."""
file_name = "s3_backend.tf"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ def tf_version(request: SubRequest) -> Iterator[str]:
file_path.unlink(missing_ok=True)


@pytest.fixture()
@pytest.fixture
def deploy_local_backend_result(
cli_runner: CliRunner, local_backend: Path # noqa: ARG001
) -> Result:
"""Execute `runway deploy` with `runway destroy` as a cleanup step."""
return cli_runner.invoke(cli, ["deploy", "--tag", "local"], env={"CI": "1"})


@pytest.fixture()
@pytest.fixture
def deploy_s3_backend_result(
cli_runner: CliRunner, s3_backend: Path # noqa: ARG001
) -> Iterator[Result]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def tf_version(request: SubRequest) -> Generator[str, None, None]:
file_path.unlink(missing_ok=True)


@pytest.fixture()
@pytest.fixture
def deploy_local_backend_result(
cli_runner: CliRunner,
local_backend: Path, # noqa: ARG001
Expand All @@ -53,7 +53,7 @@ def deploy_local_backend_result(
(CURRENT_DIR / ".terraform.lock.hcl").unlink(missing_ok=True)


@pytest.fixture()
@pytest.fixture
def deploy_no_backend_result(
cli_runner: CliRunner,
no_backend: Path, # noqa: ARG001
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/terraform/test_base/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def tf_version(request: SubRequest) -> Generator[str, None, None]:
file_path.unlink(missing_ok=True)


@pytest.fixture()
@pytest.fixture
def deploy_result(
cli_runner: CliRunner, no_backend: Path # noqa: ARG001
) -> Generator[Result, None, None]:
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ def pytest_ignore_collect(path: Any, config: Config) -> bool: # noqa: ARG001
return not (config.option.integration or config.option.integration_only)


@pytest.fixture()
@pytest.fixture
def configs() -> Path:
"""Path to Runway config fixtures."""
return TEST_ROOT.parent / "fixtures" / "configs"


@pytest.fixture()
@pytest.fixture
def cp_config(configs: Path) -> Callable[[str, Path], Path]:
"""Copy a config file."""

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


@pytest.fixture()
@pytest.fixture
def provider_get_stack(mocker: MockerFixture) -> MagicMock:
"""Patches ``runway.cfngin.providers.aws.default.Provider.get_stack``."""
return_value: StackTypeDef = {
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/cfngin/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ def cfngin_fixtures() -> Path:
return Path(__file__).parent / "fixtures"


@pytest.fixture()
@pytest.fixture
def empty_dag() -> DAG:
"""Create an empty DAG."""
return DAG()


@pytest.fixture()
@pytest.fixture
def basic_dag() -> DAG:
"""Create a basic DAG."""
dag = DAG()
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/cfngin/hooks/awslambda/test__python_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
MODULE = "runway.cfngin.hooks.awslambda._python_hooks"


@pytest.fixture()
@pytest.fixture
def args(tmp_path: Path) -> PythonHookArgs:
"""Fixture for creating default function args."""
return PythonHookArgs(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
ProjectTypeAlias = Project[AwsLambdaHookArgs]


@pytest.fixture()
@pytest.fixture
def project(cfngin_context: CfnginContext, tmp_path: Path) -> ProjectTypeAlias:
"""Mock project object."""
args = AwsLambdaHookArgs(
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/cfngin/hooks/docker/image/test__build.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
MODULE = "runway.cfngin.hooks.docker.image._build"


@pytest.fixture()
@pytest.fixture
def tmp_dockerfile(cd_tmp_path: Path) -> Path:
"""Create temporary Dockerfile."""
dockerfile = cd_tmp_path / "Dockerfile"
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/cfngin/hooks/docker/test_data_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
}


@pytest.fixture()
@pytest.fixture
def mock_image() -> MagicMock:
"""Return a mock docker.models.images.Image."""
return MagicMock(spec=Image, **MOCK_IMAGE_PROPS)
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/cfngin/hooks/ssm/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
from ....factories import MockCfnginContext


@pytest.fixture()
@pytest.fixture
def ssm_client(
cfngin_context: MockCfnginContext, ssm_stubber: Stubber # noqa: ARG001
) -> SSMClient:
"""Create SSM client."""
return cfngin_context.get_session().client("ssm")


@pytest.fixture()
@pytest.fixture
def ssm_stubber(cfngin_context: MockCfnginContext) -> Stubber:
"""Create SSM stubber."""
return cfngin_context.add_stubber("ssm")
2 changes: 1 addition & 1 deletion tests/unit/cfngin/hooks/test_keypair.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def ssh_key(cfngin_fixtures: Path) -> SSHKey:
)


@pytest.fixture()
@pytest.fixture
def context() -> CfnginContext:
"""Mock context."""
return mock_context(namespace="fake")
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/cfngin/lookups/handlers/test_awslambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
QUERY = "test::foo=bar"


@pytest.fixture()
@pytest.fixture
def hook_data() -> AwsLambdaHookDeployResponse:
"""Fixture for hook response data."""
return AwsLambdaHookDeployResponse(
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/cfngin/test_cfngin.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def copy_basic_fixtures(cfngin_fixtures: Path, tmp_path: Path) -> None:
copy_fixture(src=cfngin_fixtures / "configs" / "basic.yml", dest=tmp_path / "basic.yml")


@pytest.fixture()
@pytest.fixture
def patch_safehaven(mocker: MockerFixture) -> Mock:
"""Patch SafeHaven."""
mock_haven = mocker.patch("runway.cfngin.cfngin.SafeHaven")
Expand Down
24 changes: 12 additions & 12 deletions tests/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,19 @@ def fx_config() -> YamlLoader:
)


@pytest.fixture()
@pytest.fixture
def fx_deployments() -> YamlLoaderDeployment:
"""Return YAML loader for deployment fixtures."""
return YamlLoaderDeployment(TEST_ROOT / "fixtures" / "deployments")


@pytest.fixture()
@pytest.fixture
def mock_docker_client() -> DockerClient:
"""Create a docker client with mock API backend."""
return make_fake_client()


@pytest.fixture()
@pytest.fixture
def tempfile_temporary_directory(mocker: MockerFixture, tmp_path: Path) -> MagicMock:
"""Mock tempfile.TemporaryDirectory."""
return mocker.patch(
Expand All @@ -127,43 +127,43 @@ def yaml_fixtures(request: pytest.FixtureRequest, fixture_dir: Path) -> dict[str
return result


@pytest.fixture()
@pytest.fixture
def deploy_environment(tmp_path: Path) -> DeployEnvironment:
"""Create a deploy environment that can be used for testing."""
return DeployEnvironment(explicit_name="test", root_dir=tmp_path)


@pytest.fixture()
@pytest.fixture
def cfngin_context(runway_context: MockRunwayContext) -> MockCfnginContext:
"""Create a mock CFNgin context object."""
return MockCfnginContext(deploy_environment=runway_context.env, parameters={})


@pytest.fixture()
@pytest.fixture
def mock_sleep(mocker: MockerFixture) -> Mock:
"""Patch built-in ``time.sleep``."""
return mocker.patch("time.sleep", return_value=None)


@pytest.fixture()
@pytest.fixture
def platform_darwin(mocker: MockerFixture) -> None:
"""Patch platform.system to always return "Darwin"."""
mocker.patch("platform.system", return_value="Darwin")


@pytest.fixture()
@pytest.fixture
def platform_linux(mocker: MockerFixture) -> None:
"""Patch platform.system to always return "Linux"."""
mocker.patch("platform.system", return_value="Linux")


@pytest.fixture()
@pytest.fixture
def platform_windows(mocker: MockerFixture) -> None:
"""Patch platform.system to always return "Windows"."""
mocker.patch("platform.system", return_value="Windows")


@pytest.fixture()
@pytest.fixture
def patch_runway_config(
request: pytest.FixtureRequest, monkeypatch: pytest.MonkeyPatch, runway_config: MockRunwayConfig
) -> MockRunwayConfig:
Expand All @@ -174,13 +174,13 @@ def patch_runway_config(
return runway_config


@pytest.fixture()
@pytest.fixture
def runway_config() -> MockRunwayConfig:
"""Create a mock runway config object."""
return MockRunwayConfig()


@pytest.fixture()
@pytest.fixture
def runway_context(request: pytest.FixtureRequest, tmp_path: Path) -> MockRunwayContext:
"""Create a mock Runway context object."""
env_vars = {
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/context/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
}


@pytest.fixture()
@pytest.fixture
def mock_boto3_session(mocker: MockerFixture) -> MagicMock:
"""Mock boto3.Session."""
mock_session = MagicMock(autospec=boto3.Session)
mocker.patch(f"{MODULE}.boto3", Session=mock_session)
return mock_session


@pytest.fixture()
@pytest.fixture
def mock_sso_botocore_session(mocker: MockerFixture) -> MagicMock:
"""Mock runway.aws_sso_botocore.session.Session."""
return mocker.patch(f"{MODULE}.Session")
Expand Down
Loading

0 comments on commit c77bd15

Please sign in to comment.