fix(test_sync): use tmp_dir for elsewhere path so it stays absolute on Windows
Windows runs treated `/tmp/elsewhere/x.md` as relative because Windows absolute paths require a drive letter, so `_classify_drawer` routed `drawer_out_of_scope` to `no_source` instead of `out_of_scope` and `test_dry_run_classifies_correctly` failed on test-windows. `Path(tmp_dir) / "elsewhere" / "x.md"` is absolute on every platform and still lives outside the project root that the synced_world fixture exposes via `repo_path`, so the bucket assertions hold cross-platform.
This commit is contained in:
+6
-3
@@ -12,7 +12,7 @@ import chromadb
|
||||
import pytest
|
||||
|
||||
|
||||
def _seed_drawers(palace_path, repo_path, deleted_path):
|
||||
def _seed_drawers(palace_path, repo_path, deleted_path, elsewhere_path):
|
||||
"""Populate the drawers collection with 6 entries covering all buckets."""
|
||||
client = chromadb.PersistentClient(path=palace_path)
|
||||
col = client.get_or_create_collection("mempalace_drawers", metadata={"hnsw:space": "cosine"})
|
||||
@@ -61,7 +61,7 @@ def _seed_drawers(palace_path, repo_path, deleted_path):
|
||||
{
|
||||
"wing": "demo",
|
||||
"room": "elsewhere",
|
||||
"source_file": "/tmp/elsewhere/x.md",
|
||||
"source_file": str(elsewhere_path),
|
||||
"chunk_index": 0,
|
||||
"added_by": "miner",
|
||||
"filed_at": "2026-05-09T00:00:00",
|
||||
@@ -104,7 +104,10 @@ def synced_world(tmp_dir, palace_path):
|
||||
deleted.write_text("# was here\n")
|
||||
deleted.unlink()
|
||||
|
||||
_seed_drawers(palace_path, repo_path, deleted)
|
||||
# Use tmp_dir for an absolute path; `/tmp/...` literals are not absolute on Windows.
|
||||
elsewhere = Path(tmp_dir) / "elsewhere" / "x.md"
|
||||
|
||||
_seed_drawers(palace_path, repo_path, deleted, elsewhere)
|
||||
return {"palace_path": palace_path, "repo_path": str(repo_path)}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user