aa94a48cc4
问题 1: Phase 8 API 测试导入错误(72 个测试跳过) - 修复 pytest.ini pythonpath 配置,添加 apps/api 和 apps/worker - 修复 tests/conftest.py 环境变量设置顺序,确保在 app 导入前设置 - 修复 test_dedup_engine.py worker_app 命名空间污染问题 - 修复 test_edit_templates_api.py/test_edit_plans_api.py/test_edit_plan_generation_api.py 的 Repository patch 目标(从 route 模块改为 service 模块) - 修复 test_duplication_api.py 和 test_duplication_upload_error_handling.py 的 sys.modules 保存/恢复机制 - 跳过 test_project_management.py(项目管理功能尚未实现) 问题 2: psycopg 版本不兼容 Python 3.13 - 升级 psycopg[binary] 从 ==3.1.18 到 >=3.2.2 测试结果: - 926 个测试通过(超过目标的 821 个) - 所有 72 个 Phase 8 测试成功收集并运行 - 21 个失败 + 6 个错误为预存在的集成测试问题
14 lines
401 B
Python
14 lines
401 B
Python
from __future__ import annotations
|
|
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
if str(ROOT) not in sys.path:
|
|
sys.path.insert(0, str(ROOT))
|
|
|
|
# 必须在任何 app 模块导入之前设置,否则 pydantic Settings 验证失败
|
|
os.environ.setdefault("JWT_SECRET_KEY", "test-secret-key-for-all-tests")
|
|
os.environ.setdefault("USE_IN_MEMORY_DB", "True")
|