diff --git a/tests/unit/services/test_conventions_resolve.py b/tests/unit/services/test_conventions_resolve.py index dbd81e65..65590e91 100644 --- a/tests/unit/services/test_conventions_resolve.py +++ b/tests/unit/services/test_conventions_resolve.py @@ -4,13 +4,15 @@ from __future__ import annotations import subprocess from types import SimpleNamespace -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, cast from roboco.services.conventions import ConventionsService if TYPE_CHECKING: from pathlib import Path + from roboco.db.tables import ProjectTable + def _git_repo(root: Path) -> str: (root / "roboco" / "services").mkdir(parents=True) @@ -37,7 +39,7 @@ def _svc() -> ConventionsService: def test_resolve_reads_clone_head_and_backfills(tmp_path: Path) -> None: sha = _git_repo(tmp_path) project = SimpleNamespace(workspace_path=None, head_commit=None, slug="p") - root, head = _svc()._resolve(project, tmp_path) + root, head = _svc()._resolve(cast("ProjectTable", project), tmp_path) assert root == tmp_path assert head == sha # The backfill: the resolved path + real HEAD are persisted on the project. @@ -49,7 +51,7 @@ def test_resolve_non_git_path_keeps_persisted_head(tmp_path: Path) -> None: project = SimpleNamespace( workspace_path=str(tmp_path), head_commit="deadbeef", slug="p" ) - _root, head = _svc()._resolve(project, None) + _root, head = _svc()._resolve(cast("ProjectTable", project), None) # A non-git legacy path must not clobber the persisted head_commit. assert head == "deadbeef" assert project.head_commit == "deadbeef" @@ -57,7 +59,7 @@ def test_resolve_non_git_path_keeps_persisted_head(tmp_path: Path) -> None: def test_resolve_no_workspace_returns_none_root() -> None: project = SimpleNamespace(workspace_path=None, head_commit=None, slug="p") - root, head = _svc()._resolve(project, None) + root, head = _svc()._resolve(cast("ProjectTable", project), None) assert root is None assert head == "HEAD"