Files
resume-agent/backend/tests/conftest.py
T
hypandClaude ae2d9b128d feat: builder 简历生成 + 轻度优化 + 简历导入交付副本
自内部仓库剥离深度优化与 RAG 知识库后的交付版本:
- Builder 对话式简历生成(FSM + 意图路由 LLM 兜底增强)
- 条目级轻度优化:事实覆盖门禁 + STAR/bullet 修复链,功能/简介/成果与技术栈同级保护
- 简历导入:DOCX/PDF 解析、结构归一、手机号脱敏
- PostgreSQL 运行时 + Alembic 迁移链

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-05 11:08:30 +08:00

46 lines
1.4 KiB
Python

from __future__ import annotations
import sys
from pathlib import Path
import pytest
from fastapi.testclient import TestClient
BACKEND_ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(BACKEND_ROOT))
from app.main import create_app # noqa: E402
from app.services import ( # noqa: E402
RuleBasedEntryExpander,
RuleBasedExperienceExtractor,
RuleBasedResumeRewriter,
)
from app.settings import Settings # noqa: E402
@pytest.fixture(autouse=True)
def _intent_router_off_in_tests(monkeypatch: pytest.MonkeyPatch) -> None:
"""Keep the LLM intent gate hermetic: rescue.py lazy-loads global settings,
so a developer .env with RESUME_AGENT_INTENT_ROUTER_MODE=on must not leak
real LLM calls into the suite. Tests that need the gate stub the classifier
on the agent directly."""
monkeypatch.setattr(
"app.builder_conversation.rescue.load_settings",
lambda: Settings(llm_provider="rule", intent_router_mode="off"),
)
@pytest.fixture
def client(tmp_path: Path) -> TestClient:
application = create_app(
database_path=tmp_path / "test.db",
cors_origins=["http://localhost:5173"],
extractor=RuleBasedExperienceExtractor(),
rewriter=RuleBasedResumeRewriter(),
expander=RuleBasedEntryExpander(),
settings=Settings(llm_provider="rule"),
)
with TestClient(application) as test_client:
yield test_client