From cd790c9404157226fd1f7ee704307e6589fb86c8 Mon Sep 17 00:00:00 2001 From: Justin Gu <97915@qq.com> Date: Sat, 4 Jul 2026 02:24:48 +0800 Subject: [PATCH] =?UTF-8?q?release:=20v1.17.8=20=E2=80=94=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=20windows=203.10=20flaky=20=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E8=B6=85=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test_task_runner_does_not_evict_running 用 release.wait(timeout=5) 钉住慢任务保持 running,但 CI 慢环境(windows 3.10)下整个测试执行超过 5s 后任务因超时自动完成、 状态变 done,掩盖了「running 任务被 LRU 错误淘汰」的回归断言。 改为 timeout=30 留足 CI 慢环境余量(release.set() 仍是确定性释放点)。该测试用于 守护 LRU 淘汰跳过 running 任务的并发正确性,与港股逐笔成交无关,是 v1.17.2 引入的 预先存在问题。 本地连跑 5 次稳定通过,867 单测全绿。 --- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- tests/unit/test_web_backtest.py | 5 ++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f517c8..7f4c681 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ 本文件记录 easy-tdx 的版本变更。格式遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/)。 +## [1.17.8] — 2026-07-04 + +**修复 Windows CI 矩阵 flaky 测试** —— `test_task_runner_does_not_evict_running` 用 `release.wait(timeout=5)` 钉住慢任务保持 running,但 CI 慢环境(windows 3.10)下整个测试执行超过 5s 后任务因超时自动完成、状态变 `done`,掩盖了「running 任务被 LRU 错误淘汰」的回归断言。改为 `timeout=30` 留足 CI 慢环境余量(`release.set()` 仍是确定性释放点)。**867 单测全绿**(本地连跑 5 次稳定通过),Windows 全矩阵转绿。 + +### 修复 + +- **flaky 时序测试超时**(`tests/unit/test_web_backtest.py::test_task_runner_does_not_evict_running`)—— `slow_task` 的 `release.wait(timeout=5)` 在 CI 慢环境下不够整个测试跑完,改为 `timeout=30`。该测试用于守护「LRU 淘汰跳过 running 任务」的并发正确性回归(审计修复),与港股逐笔成交无关,是 v1.17.2 引入的预先存在问题。 + ## [1.17.7] — 2026-07-04 **修复 Windows CI:fixture 文件读取编码** —— 1.17.5 引入的 `tests/fixtures/ex_history_transaction.json` 含中文注释,Windows CI 默认用 cp1252 解码 UTF-8 文件触发 `UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f`,导致 3 个 Windows 矩阵(3.10/3.12/3.13)的 `test_parse_ex_history_transaction_hk` 失败。统一为 fixture 读取显式指定 `encoding="utf-8"`。**867 单测全绿**,ruff format/check / mypy strict 通过,Windows + Linux 矩阵均转绿。 diff --git a/pyproject.toml b/pyproject.toml index 448df95..8e39b8e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "easy-tdx" -version = "1.17.7" +version = "1.17.8" description = "通达信 TCP 协议行情数据客户端,支持在线行情、离线数据读取与写入同步" readme = "README.md" requires-python = ">=3.10" diff --git a/tests/unit/test_web_backtest.py b/tests/unit/test_web_backtest.py index 2f93334..cad6ad9 100644 --- a/tests/unit/test_web_backtest.py +++ b/tests/unit/test_web_backtest.py @@ -354,7 +354,10 @@ def test_task_runner_does_not_evict_running(monkeypatch): def slow_task() -> dict[str, object]: started.set() - release.wait(timeout=5) + # 无短超时:CI 慢环境(如 windows 3.10)下 5s 可能不够整个测试跑完, + # 任务会因超时自动完成导致状态变 done,掩盖「running 被淘汰」的回归。 + # release.set()(测试末尾)是唯一释放点;若回归发生,断言会先失败。 + release.wait(timeout=30) return {"slow": True} running_id = runner.submit(slow_task, description="slow")