fix: fail-loud on missing evolve/diagnose templates (no silent empty)
This commit is contained in:
@@ -23,3 +23,32 @@ def test_evolve_template_present_and_contract(name: str, required_tokens: list[s
|
||||
assert text.strip(), f"模板为空: {path}"
|
||||
for token in required_tokens:
|
||||
assert token in text, f"{name} 缺输出契约关键词 {token!r}(与解析代码不对齐)"
|
||||
|
||||
|
||||
def test_video_split_loader_fail_loud_on_missing(tmp_path, monkeypatch):
|
||||
"""video_split_cli 的真实 diagnose 加载器缺模板必须 FileNotFoundError。"""
|
||||
monkeypatch.chdir(tmp_path) # 空目录,无 prompts/*.md
|
||||
from app.harness.video_split_cli import _load_diagnose_prompts
|
||||
|
||||
with pytest.raises(FileNotFoundError, match="缺进化/诊断模板"):
|
||||
_load_diagnose_prompts()
|
||||
|
||||
|
||||
def test_runner_evolve_loader_fail_loud_on_missing(tmp_path, monkeypatch):
|
||||
"""runner 的真实 evolve 加载器缺模板必须 FileNotFoundError。"""
|
||||
monkeypatch.chdir(tmp_path)
|
||||
from app.harness.runner import Runner
|
||||
|
||||
r = object.__new__(Runner) # 绕过 __init__,仅测无状态加载器方法
|
||||
with pytest.raises(FileNotFoundError, match="缺进化/诊断模板"):
|
||||
r._load_evolve_prompts()
|
||||
|
||||
|
||||
def test_runner_diagnose_loader_fail_loud_on_missing(tmp_path, monkeypatch):
|
||||
"""runner 的真实 diagnose 加载器缺模板必须 FileNotFoundError。"""
|
||||
monkeypatch.chdir(tmp_path)
|
||||
from app.harness.runner import Runner
|
||||
|
||||
r = object.__new__(Runner)
|
||||
with pytest.raises(FileNotFoundError, match="缺进化/诊断模板"):
|
||||
r._load_diagnose_prompts()
|
||||
|
||||
Reference in New Issue
Block a user