test_path_normalize.py python
47 lines 1.8 KB
Raw
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 1 day ago
1 """Unit tests for docs-root ``.`` normalization (§K6.5.2)."""
2
3 from __future__ import annotations
4
5 from pathlib import Path
6
7 import pytest
8
9 from adapters.config import load_config
10 from adapters.errors import ConfigError
11 from adapters.templating import build_token_map
12 from cli.docs_paths import join_docs_rel
13 from cli.footprint import resolve_footprint
14 from tests.support import PILOT
15
16
17 def test_join_docs_rel_dot_sentinel() -> None:
18 assert join_docs_rel(".", "OVERSEER_HANDOVER.md") == "OVERSEER_HANDOVER.md"
19 assert join_docs_rel("docs", "OVERSEER-HANDOVER.md") == "docs/OVERSEER-HANDOVER.md"
20
21
22 def test_empty_root_relative_docs_fails_closed(tmp_path: Path) -> None:
23 cfg = tmp_path / "bad.yaml"
24 cfg.write_text(
25 (PILOT / "config-videofactory.yaml")
26 .read_text(encoding="utf-8")
27 .replace('root_relative_docs: "."', 'root_relative_docs: ""'),
28 encoding="utf-8",
29 )
30 with pytest.raises(ConfigError):
31 load_config(cfg)
32
33
34 def test_videofactory_bare_paths(tmp_path: Path) -> None:
35 config = load_config(PILOT / "config-videofactory.yaml")
36 tokens = build_token_map(config)
37 assert tokens["docs.handover_path"] == "VIDEO_OVERSEER_HANDOVER.md"
38 assert tokens["docs.roadmap_path"] == "VIDEO_PRODUCTION_STATUS_BOARD.md"
39 assert tokens["docs.handover_title"] == "Video Overseer Handover"
40 assert tokens["docs.roadmap_title"] == "Video Production Status Board"
41 assert not tokens["docs.handover_path"].startswith("./")
42 assert not tokens["docs.handover_path"].startswith("/")
43 rendered = resolve_footprint(config)
44 dests = {f.destination for f in rendered}
45 assert "VIDEO_OVERSEER_HANDOVER.md" in dests
46 assert "VIDEO_PRODUCTION_STATUS_BOARD.md" in dests
47 assert "docs/OVERSEER_HANDOVER.md" not in dests
File History 2 commits
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 1 day ago
sha256:4671b7f787ddbe63ced31c895b688c77ab495653b65a730b423329f26b3c1439 feat: K1-P1 complete — agent provenance, build-verification… Sonnet 4.6 patch 52 days ago