Skip to content

Commit ade9868

Browse files
committed
test: fix cross-platform path and DB-isolation failures in CI
1 parent e6efbff commit ade9868

2 files changed

Lines changed: 19 additions & 5 deletions

File tree

tests/test_autobuild_runner.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,15 @@ def fake_stages(_recipe):
9191
assert events[-1] == {"result": {"picks": ["ok"]}}
9292

9393

94-
def test_run_preview_events_empty_recipe_yields_only_result(monkeypatch):
95-
"""A size-0 recipe skips the stages and streams the empty payload."""
94+
def test_run_preview_events_empty_recipe_yields_only_result(
95+
monkeypatch, store_db
96+
):
97+
"""A size-0 recipe skips the stages and streams the empty payload.
98+
99+
``store_db`` supplies a schema'd in-memory database: the empty payload
100+
still probes ``_semantic_available`` (a media/embedding read), which must
101+
not fall through to the developer's real database.
102+
"""
96103
monkeypatch.setattr(runner.config, "load_autobuild_config", lambda: {})
97104
monkeypatch.setattr(runner, "_recipe_of", lambda _p, _b: Recipe(size=0))
98105

tests/test_folder_rules.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Tests for the subfolder-mapping engine and its repository."""
22

3+
import os
4+
35
from src import folder_rules as fr
46
from src import sqlite_store as store
57

@@ -17,16 +19,21 @@ def test_slugify_preserves_case(self):
1719

1820
def test_rel_folder_under_root(self):
1921
"""A file's folder is returned relative to the root, ``/``-joined."""
20-
rel = fr.rel_folder(r"C:\d\vet\robe\a.png", r"C:\d\vet")
22+
# Native separators so the path parses on every OS the app runs on.
23+
root = os.path.join(os.sep, "d", "vet")
24+
rel = fr.rel_folder(os.path.join(root, "robe", "a.png"), root)
2125
assert rel == "robe"
2226

2327
def test_rel_folder_root_level(self):
2428
"""A file directly in the root yields the empty rel_path."""
25-
assert fr.rel_folder(r"C:\d\vet\a.png", r"C:\d\vet") == ""
29+
root = os.path.join(os.sep, "d", "vet")
30+
assert fr.rel_folder(os.path.join(root, "a.png"), root) == ""
2631

2732
def test_rel_folder_outside_root(self):
2833
"""A file outside the root degrades to the root, never raises."""
29-
assert fr.rel_folder(r"D:\other\a.png", r"C:\d\vet") == ""
34+
root = os.path.join(os.sep, "d", "vet")
35+
outside = os.path.join(os.sep, "other", "a.png")
36+
assert fr.rel_folder(outside, root) == ""
3037

3138

3239
class TestExcludeAndRouting:

0 commit comments

Comments
 (0)