test_path_normalize.py python
47 lines 1.8 KB
Raw
sha256:0e9549ec7b463911bc08b7d586dc320b1ac9b1f5c943ee7e3865dcc6cb0f6f83 chore(governance): sync handover+roadmap to 84db8c8 (drift:… Human 2 days 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 1 commit
sha256:6abcf1fa82a7a621ccbc945f19acdba5bc0db54569599404a1452fb4a096a199 fix(ISR): default require_independent_second_reviewer to require Human minor 2 days ago