Build the handler test's address list without a shared mutable default 🟪

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Daniel Roth 2026-07-29 09:21:11 +00:00
parent bbb3c9e057
commit bf1f5693be

View file

@ -14,7 +14,7 @@ from collections.abc import Generator, Iterator
from contextlib import contextmanager
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Callable, cast
from typing import Any, Callable, Optional, cast
from uuid import UUID
import pytest
@ -122,12 +122,14 @@ def _install(
tmp_path: Path,
sharepoint: FakeSharepoint,
*,
rows: list[tuple[str, str, str]] = [(UPRN, ADDRESS, POSTCODE)],
rows: Optional[list[tuple[str, str, str]]] = None,
) -> None:
"""Point the handler at the fake SharePoint and a small address list, and
configure the site the tests target."""
import applications.sharepoint_renamer.handler as module
rows = rows if rows is not None else [(UPRN, ADDRESS, POSTCODE)]
monkeypatch.setenv(f"{SITE}_SHAREPOINT_ID", "test-site-id")
def client_for(_site: DomnaSites) -> FakeSharepoint: