Files
blackbird/aibox/tests/conftest.py
T
qing eadba81c26 refactor(aibox): 抽离工具类与子系统,附单测基线
A 批(tools/basic_tools.py):迁移 7 个无外部依赖工具类(FileToolBase/ReadFileTool/WriteFileTool/ListFilesTool/SimpleWebCrawlerTool/GetCurrentTimeTool/CalculatorTool)

Wave1(subsystems/):迁移 5 个叶子子系统(CommandExecutor/SubprocessCommandExecutor/PromptManager/MemoryDatabase/MemoDatabase/SkillManager),aibox.py 减少 ~1440 行

新增 tests/ 单测 113 个用例全绿,依赖方向维持 common -> subsystems -> tools -> aibox 单向
2026-08-13 15:48:55 +08:00

22 lines
840 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.
"""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))
# 桩掉 websockets(aibox.py 顶部 import websockets,测试环境可能未安装)
if "websockets" not in sys.modules:
sys.modules["websockets"] = types.ModuleType("websockets")
import pytest # noqa: E402