- models 配置节:多 OpenAI Chat Completions 兼容端点按档案名切换,默认空 dict 零破坏回退旧 api 节 - --model 双语义:档案名(命中 models 节完整采用)/ 裸模型名(同端点换模型) - resolve_api_key 档案级 env 三级语义:未配置回退 api.api_key_env / 显式名称 / 空串免密(Ollama/vLLM) - 档案级 reasoning_enabled 附加 client 属性,DeepSeekChat._reasoning_enabled 优先读取 - llm_client 增加 openai_compatible/openai provider 别名 - README 更新:aibox/README 六处(特性/配置/多模型档案专节/CLI 参数/更新日志 v3.2/测试计数 264)+ 根 README aibox 小节 - 单测 17 项新增(test_models_profile.py),全套 264 项全过
24 lines
1012 B
Python
24 lines
1012 B
Python
"""pytest 公共配置:把 aibox 目录加入 sys.path,桩掉可选第三方依赖。
|
||
|
||
aibox 主模块 aibox.py 依赖 websockets,但 tools/basic_tools.py 仅依赖
|
||
common + 标准库,所以单测 basic_tools 不需要真实 websockets——桩掉即可
|
||
让 `from tools import ...` 间接 import aibox.py 时不出错(虽然本测试
|
||
不直接 import aibox,但保持环境干净)。
|
||
"""
|
||
|
||
import sys
|
||
import types
|
||
from pathlib import Path
|
||
|
||
# 把 aibox 目录加入 sys.path(无需安装为包即可 import tools/common)
|
||
AIBOX_DIR = Path(__file__).resolve().parent.parent
|
||
sys.path.insert(0, str(AIBOX_DIR))
|
||
# tests 目录也加入:测试文件互相导入(如 test_models_profile 复用 test_once_mode 的 _make_ai)
|
||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||
|
||
# 桩掉 websockets(aibox.py 顶部 import websockets,测试环境可能未安装)
|
||
if "websockets" not in sys.modules:
|
||
sys.modules["websockets"] = types.ModuleType("websockets")
|
||
|
||
import pytest # noqa: E402
|