Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 21 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 @@ -37,7 +37,7 @@ botocore = "^1.40.57"
aws-xray-sdk = "2.15.0"

[tool.poetry.group.dev.dependencies]
ruff = "^0.11.13"
ruff = "^0.14.10"
docopt = "^0.6.2"
jsonpath-rw = "^1.4.0"
semver = "^3.0.4"
Expand Down
2 changes: 1 addition & 1 deletion scripts/config/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ repos:
language: script
pass_filenames: false
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.7
rev: v0.14.10
hooks:
- id: ruff
args: [--fix]
Expand Down
2 changes: 1 addition & 1 deletion src/eligibility_signposting_api/model/campaign_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class IterationRule(BaseModel):
model_config = {"populate_by_name": True, "extra": "ignore"}

@field_validator("rule_stop", mode="before")
def parse_yn_to_bool(cls, v: str | bool) -> bool: # noqa: N805
def parse_yn_to_bool(cls, v: str | bool) -> bool: # noqa: N805, FBT001
if isinstance(v, str):
return v.upper() == "Y"
return v
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def get_best_iteration_result(self, campaign_group: list[CampaignConfig]) -> Bes
if not iteration_results:
return None

(best_iteration_name, best_iteration_result) = max(
(_best_iteration_name, best_iteration_result) = max(
iteration_results.items(),
key=lambda item: next(iter(item[1].cohort_results.values())).status.value
# Below handles the case where there are no cohort results
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def iam_role(iam_client: BaseClient) -> Generator[str]:

@pytest.fixture(scope="session")
def lambda_zip() -> Path:
build_result = subprocess.run(["make", "build"], capture_output=True, text=True, check=False) # Noqa: S603, S607
build_result = subprocess.run(["make", "build"], capture_output=True, text=True, check=False) # noqa: S607
assert build_result.returncode == 0, f"'make build' failed: {build_result.stderr}"
return Path("dist/lambda.zip")

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/logging/test_logs_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import pytest
from mangum.types import LambdaContext

from eligibility_signposting_api.app import log_request_ids_from_headers


@pytest.fixture
def lambda_context():
Expand Down Expand Up @@ -46,8 +48,6 @@ def lambda_context():
],
)
def test_log_request_ids_decorator_logs_metadata(headers, gateway_request_id, expected_extra, lambda_context, caplog):
from eligibility_signposting_api.app import log_request_ids_from_headers

event = {"headers": headers}
if gateway_request_id is not None:
event["requestContext"] = {"requestId": gateway_request_id}
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/middleware/test_security_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from http import HTTPStatus

import pytest
from flask import Flask
from flask import Flask, make_response
from flask.testing import FlaskClient
from hamcrest import assert_that, contains_string, equal_to, has_entries, is_

Expand Down Expand Up @@ -152,8 +152,6 @@ def test_existing_headers_are_not_overridden(self) -> None:

@app.route("/test")
def test_route():
from flask import make_response

resp = make_response({"status": "ok"}, HTTPStatus.OK)
resp.headers["Cache-Control"] = "public, max-age=3600"
return resp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1436,7 +1436,7 @@ def test_eligibility_status_with_invalid_tokens_raises_attribute_error(faker: Fa

calculator = EligibilityCalculator(person_rows, campaign_configs)

with pytest.raises(ValueError, match="Invalid token."):
with pytest.raises(ValueError, match=r"Invalid token format\."):
calculator.get_eligibility_status("Y", ["ALL"], "ALL")


Expand Down
4 changes: 2 additions & 2 deletions tests/unit/services/processors/test_token_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_parse_valid_tokens(self, token, expected_level, expected_name, expected
],
)
def test_parse_invalid_tokens_raises_error(self, token):
with pytest.raises(ValueError, match="Invalid token."):
with pytest.raises(ValueError, match=r"Invalid token\."):
TokenParser.parse(token)

@pytest.mark.parametrize(
Expand All @@ -53,5 +53,5 @@ def test_parse_invalid_tokens_raises_error(self, token):
],
)
def test_parse_invalid_token_format_raises_error(self, token):
with pytest.raises(ValueError, match="Invalid token format."):
with pytest.raises(ValueError, match=r"Invalid token format\."):
TokenParser.parse(token)
2 changes: 1 addition & 1 deletion tests/unit/services/processors/test_token_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def test_valid_token_invalid_format_should_raise_error(self, token_format: str):
actions=[],
)

with pytest.raises(ValueError, match="Invalid token format."):
with pytest.raises(ValueError, match=r"Invalid token format\."):
TokenProcessor.find_and_replace_tokens(person, condition)

@pytest.mark.parametrize(
Expand Down
Loading