跳到主要内容

ISSUE-047:pytest 全量被未注册 slow 标记的 CrossRing 大仿真卡住

发现日期:2026-06-11 状态已修复 类型实现 bug 影响范围:全量 pytest tests/ 在约 20% 处停止推进,10 分钟以上不结束;单独跑 tests/evaluation/g5/ 不受影响(5.58 秒完成)。


问题现象

  • pytest tests/ 在进度 18-20% 处停止推进,10 分钟以上未结束(两轮复现一致)。
  • verbose 模式定位停在 tests/evaluation/crossring/test_e2e.py::test_e2e_allreduce_8chip_8mb
  • tests/evaluation/g5/ 单跑 47 条只需 5.58 秒,CP prefill/decode e2e 含真实 G5 仿真。

调查过程

  • [实验] 单跑 tests/evaluation/g5/:5.58s,43 passed → G5 目录本身排除。
  • [实验] 全量 pytest tests/ 后台运行:10 分钟无输出,python 进程驻留 500+ MB → 复现卡住。
  • [查代码] verbose 复跑,最后一条已启动用例为 test_e2e_allreduce_8chip_8mb(8 chip AllReduce 8MB,timeout_empty_ticks=2_000_000),文件头声明「标 @slow(默认不跑,需 -m slow)」。
  • [查代码] pyproject.toml markers 仅注册 unit/integration,无 slow,且无 -m "not slow";warning 早已提示 PytestUnknownMarkWarning: Unknown pytest.mark.slow → 确认根因。

根因分析

@pytest.mark.slowtests/evaluation/crossring/test_e2e.py:56)依赖默认排除约定,但 pyproject.toml 既未注册 slow mark,也未配置 addopts = -m "not slow"。「默认不跑」从未生效,CrossRing 8 chip AllReduce 8MB 大仿真每次全量都真实执行,单条耗时 10 分钟以上。


Spec / 文档依据

项目内:测试文件 docstring「8 chip AllReduce 8MB 标 @slow(默认不跑,需 -m slow)」——设计意图明确为默认排除。


解决方案

采用方案

注册 slow mark 并默认排除:

文件改动说明
pyproject.tomlmarkers 增加 slow,新增 addopts = "-m 'not slow'"

需要跑大仿真时显式 pytest -m slow tests/evaluation/crossring/


验证

  • 修复前:pytest tests/ 卡在 20%,>10 分钟。
  • 修复后:1337 passed, 5 skipped, 1 deselected, 32.6 秒完成。

遗留问题

与卡住无关的预先存在失败,需另行处理:

  • 46 failed:tests/topology_routing/ 多为拓扑配置改名遗留(P1-R1-B4-C32P1-R1-B4-C32-ring,commit 811b8c4);tests/entry/test_sweep_config.py::test_baseline_yaml_loads YAML 未指定 encoding='utf-8' 触发 GBK UnicodeDecodeError。
  • 4 errors:tests/evaluation/g5/test_comm_primitive_pipeline.py 同为拓扑改名遗留。