test(sync): use OS-absolute paths in watch selection tests

The absolute-path sync guard from the previous commit now checks every
project's path, not just cloud-mode ones. Three existing watch-selection
tests hardcoded POSIX paths like "/tmp/alpha", which are absolute on
Linux/macOS but not on Windows (no drive letter), so the guard filtered
them out and the tests failed on windows-latest.

Build the project paths from the tmp_path fixture so they are absolute on
every platform. Production paths are unaffected: real local projects are
always resolved to OS-absolute paths at creation.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Drew Cain <groksrc@gmail.com>
This commit is contained in:
Drew Cain
2026-06-12 17:04:36 -05:00
committed by Drew Cain
parent 8dd6451dfe
commit 598965c389
+11 -8
View File
@@ -71,15 +71,18 @@ async def _register_local_projects(
@pytest.mark.asyncio
async def test_select_projects_to_watch_returns_all_when_unconstrained(
app_config: BasicMemoryConfig, project_repository
app_config: BasicMemoryConfig, project_repository, tmp_path
):
"""Without a --project constraint, every active project is watched."""
# Use tmp_path so the project paths are OS-absolute on Windows too — a
# POSIX-style "/tmp/alpha" is not absolute on Windows (no drive letter),
# and _select_projects_to_watch now skips non-absolute paths (issue #949).
await _register_local_projects(
app_config,
project_repository,
[
{"name": "project-alpha", "path": "/tmp/alpha"},
{"name": "project-beta", "path": "/tmp/beta"},
{"name": "project-alpha", "path": str(tmp_path / "alpha")},
{"name": "project-beta", "path": str(tmp_path / "beta")},
],
)
@@ -94,7 +97,7 @@ async def test_select_projects_to_watch_returns_all_when_unconstrained(
@pytest.mark.asyncio
async def test_select_projects_to_watch_filters_to_constrained_project(
app_config: BasicMemoryConfig, project_repository
app_config: BasicMemoryConfig, project_repository, tmp_path
):
"""With ``constrained_project`` set, only that project is returned.
@@ -106,8 +109,8 @@ async def test_select_projects_to_watch_filters_to_constrained_project(
app_config,
project_repository,
[
{"name": "project-alpha", "path": "/tmp/alpha"},
{"name": "project-beta", "path": "/tmp/beta"},
{"name": "project-alpha", "path": str(tmp_path / "alpha")},
{"name": "project-beta", "path": str(tmp_path / "beta")},
],
)
@@ -124,13 +127,13 @@ async def test_select_projects_to_watch_filters_to_constrained_project(
@pytest.mark.asyncio
async def test_select_projects_to_watch_empty_when_constrained_project_missing(
app_config: BasicMemoryConfig, project_repository
app_config: BasicMemoryConfig, project_repository, tmp_path
):
"""An unknown constraint yields an empty watch set rather than watching everything."""
await _register_local_projects(
app_config,
project_repository,
[{"name": "project-alpha", "path": "/tmp/alpha"}],
[{"name": "project-alpha", "path": str(tmp_path / "alpha")}],
)
service = WatchService(