- 新增 evidence_model.py:统一证据模型(source_type + images 列表),访问器兼容旧 image_b64/image_mime 单图字段 - phases/evidence.py:新增 collect() 多源分发 seam(仅 CAD)、capture_images() 整体+等分象限多图(结束复位视口)、sub_windows() - phases/review.py:多图逐张下采样喂 LLM,payload 增加 source_type - config.py:EVIDENCE_DETAIL_TILES=4 / EVIDENCE_MAX_IMAGES=5(默认开启多图) - 新增 tests/test_evidence_model.py,更新 evidence/review 断言与 fakes 归一
33 lines
1020 B
Python
33 lines
1020 B
Python
"""pytest 全局配置(位于仓库根,保证 `import dwg_review` 可用)。
|
|
|
|
注意:`dwg_review.config` 的常量在**导入期**就已定值,改 `os.environ` 不会生效,
|
|
所以测试里一律用 `monkeypatch.setattr(config, "XXX", ...)` 覆盖模块属性。
|
|
"""
|
|
|
|
import pathlib
|
|
import sys
|
|
|
|
import pytest
|
|
|
|
_ROOT = pathlib.Path(__file__).resolve().parent
|
|
if str(_ROOT) not in sys.path:
|
|
sys.path.insert(0, str(_ROOT))
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def _fast_defaults(monkeypatch):
|
|
"""单元测试默认:不等待渲染、取证只取整体单图(多图用例自行覆盖 tiles)。"""
|
|
from dwg_review import config
|
|
|
|
monkeypatch.setattr(config, "RENDER_WAIT", 0)
|
|
monkeypatch.setattr(config, "EVIDENCE_DETAIL_TILES", 0)
|
|
|
|
|
|
@pytest.fixture
|
|
def tmp_reports(tmp_path, monkeypatch):
|
|
"""把报告输出目录指向临时目录,避免测试污染仓库的 reports/。"""
|
|
from dwg_review import config
|
|
|
|
monkeypatch.setattr(config, "REPORT_DIR", tmp_path)
|
|
return tmp_path
|