Files
DEMO-AGENT/tests/conftest.py

15 lines
529 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import pytest
@pytest.fixture(autouse=True)
def force_mock_llm_provider_for_tests(monkeypatch):
"""
测试环境固定使用 mock Provider。
当前项目会从根目录 `.env` 自动读取真实模型配置,这对本地运行很有帮助,
但单元测试和页面回归测试不应该依赖外部网络或真实密钥状态。
因此这里统一覆盖为 mock保证测试稳定、可重复。
"""
monkeypatch.setenv("LLM_PROVIDER", "mock")
monkeypatch.setenv("LLM_MODEL", "mock-model")