# -*- coding: utf-8 -*- """pytest 路径修补: 让 scripts/data_platform/* 的 sibling import 在测试下可用。 VPS 上 bs_eod.py 作为脚本跑(scripts/data_platform 在 sys.path[0]), `from dbbardata_utils import ...` 可用。pytest 以包导入 `scripts.data_platform.bs_eod` 时 sibling import 失败 — 此处把 script dir 加到 sys.path 兼容两种运行模式。 """ import sys from pathlib import Path _SCRIPT_DIR = Path(__file__).resolve().parents[2] / "scripts" / "data_platform" if str(_SCRIPT_DIR) not in sys.path: sys.path.insert(0, str(_SCRIPT_DIR))