34 lines
1.3 KiB
Python
34 lines
1.3 KiB
Python
"""离线诊断注入:build_diagnosis_deps 按 video_ids 填充非空 tree_data。"""
|
|
|
|
from pathlib import Path
|
|
from unittest.mock import patch
|
|
|
|
from app.harness.video_split_cli import build_diagnosis_deps
|
|
|
|
|
|
def test_build_diagnosis_deps_loads_tree_for_videos():
|
|
with (
|
|
patch("app.harness.video_split_cli._DiagLLMSettings") as settings_cls,
|
|
patch("adapters.llm.GovernedLLMClient"),
|
|
patch("adapters.telemetry.SQLiteTelemetryRecorder"),
|
|
patch("app.harness.video_split_cli._build_redis_cache", return_value=None),
|
|
):
|
|
s = settings_cls.return_value
|
|
s.search_llm_model = "deepseek-v4-pro"
|
|
s.search_llm_base_url = "http://x"
|
|
s.search_llm_api_key = "k"
|
|
s.llm_circuit_breaker_threshold = 32
|
|
s.llm_circuit_breaker_cooldown = 60
|
|
s.llm_timeout = s.llm_ttft_timeout = s.llm_inter_token_timeout = 60
|
|
s.llm_max_retries = 1
|
|
s.llm_retry_base_delay = s.llm_retry_max_delay = 1
|
|
deps = build_diagnosis_deps(
|
|
harness_db=Path("workspaces/default/harness.db"),
|
|
store_dir=Path("store"),
|
|
video_ids=["0RxMZBLeqRI"],
|
|
concurrency=1,
|
|
expected_model="deepseek-v4-pro",
|
|
)
|
|
assert "0RxMZBLeqRI" in deps.tree_data
|
|
assert deps.tree_data["0RxMZBLeqRI"]["nodes"]
|