Files
sanguo_vnpy_v2/tests/data_platform/conftest.py
T
claude_dev b06af336c3 fix(data): bs_eod 15min datetime 格式 bug 根治 + --no-daily 选项
bug 根因(2026-07-25): baostock 15min 实测 date='2026-07-21'(带 -),
time='20260721094500000'(17 位 YYYYMMDDHHMMSSmmm)。原代码假设 date 纯数字 +
time[:6] 取年月, 产乱 datetime 致 dbbardata 15min 全市场停 2026-07-17(8 天
没正确累积), 日线正常(7-24)。

修复:
- 提纯函数 _build_15m_dt(date_series, time_series): date 直连 + 从 17 位 time
  第 8-12 位提取 HHMM, 产出 'YYYY-MM-DD HH:MM:00' (符合 GLOB 清理模式)
- upsert_15m 调用 _build_15m_dt 替代内联拼接
- 新增 --no-daily 选项(只跑 15min, 用于重灌快), 与 --no-15m 对称
- TDD: 8 case 覆盖(09:45/14:30/15:00/13:00/跨日/多行混合/GLOB 格式)
- conftest.py 修补 sibling import 在 pytest 下可用
2026-07-25 21:14:12 +08:00

14 lines
580 B
Python

# -*- 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))