test: require evidence files behind coverage exclusions
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ from spec_coverage import (
|
||||
Scenario,
|
||||
all_scenarios,
|
||||
coverage_problems,
|
||||
missing_evidence,
|
||||
spec_scenarios,
|
||||
)
|
||||
|
||||
@@ -55,6 +56,32 @@ def test_exclusions_explain_reason_and_check() -> None:
|
||||
assert exclusion.check.strip(), f"{capability} / {scenario}"
|
||||
|
||||
|
||||
def test_exclusion_evidence_exists() -> None:
|
||||
"""Файл evidence, на который ссылается исключение, есть в репозитории
|
||||
(спек student-tests, «Доказательства исключений сверки в
|
||||
репозитории»)."""
|
||||
problems = missing_evidence(EXCLUDED)
|
||||
assert not problems, "\n".join(problems)
|
||||
|
||||
|
||||
def test_missing_evidence_fails(tmp_path: Path) -> None:
|
||||
excluded = {
|
||||
("health", "Сценарий"): Exclusion(
|
||||
reason="r",
|
||||
check="команда — evidence/demo/file.md",
|
||||
),
|
||||
}
|
||||
assert missing_evidence(excluded, tmp_path) == [
|
||||
"exclusion refers to missing evidence/demo/file.md: health / Сценарий",
|
||||
]
|
||||
(tmp_path / "evidence" / "demo").mkdir(parents=True)
|
||||
(tmp_path / "evidence" / "demo" / "file.md").write_text(
|
||||
"x",
|
||||
encoding="utf-8",
|
||||
)
|
||||
assert missing_evidence(excluded, tmp_path) == []
|
||||
|
||||
|
||||
def test_scenario_parser(tmp_path: Path) -> None:
|
||||
spec = tmp_path / "demo" / "spec.md"
|
||||
spec.parent.mkdir()
|
||||
|
||||
Reference in New Issue
Block a user