"""测试根 conftest —— 让 `from quant_engine.X import ...` 在不装包时也能工作。 - pytest 默认不会把 `src/` 加进 sys.path - 我们用 sys.path.insert 在 conftest 阶段把 src/ 加进去 - 这样 `from quant_engine.X import ...` 能找到 `src/quant_engine/X.py` """ from __future__ import annotations import sys from pathlib import Path # 把 src/ 加进 sys.path(pytest 启动时先于 collection) _SRC = Path(__file__).resolve().parent.parent / "src" if str(_SRC) not in sys.path: sys.path.insert(0, str(_SRC))