本地测试失败分析修复
pytest.fix_local_tests
分析并修复本地运行中失败的测试
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-02
- Stars
- ★ 155
- Forks
- 170
01 前言 Front Matter
- model
- haiku
- description
- Analyze and fix failure of local tests
02 资源文件 5
- 参考文档questions-academic.md7.9 KB
- 参考文档references/checkpoint-schema.md7.3 KB
- 参考文档references/stub-definition.md3.6 KB
- 脚本voice-migrate.sh6.5 KB
- 脚本voice-sync.sh963 B
03 SKILL.md 正文
Goal
- Given information about failed tests
<FAILURE_INFO>run the tests, understand what is the root cause, and fix them
Workflow
Run Tests
-
The input
<FAILURE_INFO>can be:- A failing test in pytest
- E.g.,
dev_scripts_helpers/documentation/test/test_notes_to_pdf.py
- E.g.,
- A repro generated by
pytest_failed_multi_build.py- E.g.,
tmp.pytest_failed_multi_build.repro.sh
- E.g.,
- A failing test in pytest
-
Gather information about the failing tests by:
- Reading the code
- Inspecting the content of
<FAILURE_INFO> - Running the tests locally, if needed
- E.g.,
> pytest_log `<FAILURE_INFO>` > tmp.pytest_failed_multi_build.repro.sh
- E.g.,
Analyze Failures
-
Read
.claude/skills/pytest.rules.mdabout how to diagnose issues -
Collect the failing tests from the run
> i pytest_failed ... Failed tests: 25/7 dev_scripts_helpers/documentation/test/test_notes_to_pdf.py::Test_notes_to_pdf_actions::test1 dev_scripts_helpers/documentation/test/test_notes_to_pdf.py::Test_notes_to_pdf_actions::test2 dev_scripts_helpers/documentation/test/test_notes_to_pdf.py::Test_notes_to_pdf_edge_cases::test1 dev_scripts_helpers/documentation/test/test_notes_to_pdf.py::Test_notes_to_pdf_edge_cases::test2 dev_scripts_helpers/documentation/test/test_notes_to_pdf.py::Test_notes_to_pdf_edge_cases::test3 dev_scripts_helpers/documentation/test/test_notes_to_pdf.py::Test_notes_to_pdf_edge_cases::test4 dev_scripts_helpers/documentation/test/test_notes_to_pdf.py::Test_notes_to_pdf_filters::test1 dev_scripts_helpers/documentation/test/test_notes_to_pdf.py::Test_notes_to_pdf_filters::test2 dev_scripts_helpers/documentation/test/test_notes_to_pdf.py::Test_notes_to_pdf_filters::test3 dev_scripts_helpers/documentation/test/test_notes_to_pdf.py::Test_notes_to_pdf_filters::test4 dev_scripts_helpers/documentation/test/test_notes_to_pdf.py::Test_notes_to_pdf_filters::test5 ... 13:07:36 - WARN lib_tasks_pytest.py pytest_failed:1745 To run the failed tests run: tmp.pytest_failed.sh ... -
For the tests that involve running Docker / Apple containers run the same tests with different builds, as per
## Analyze the Effect of Container Buildsin.claude/skills/pytest.rules.md -
Carefully consider if the root cause and the solution is the same for all the 3 builds
Prepare A Plan to Fix Failures
- Prepare a plan following
# Format for Unit Test Fixing Planfrom.claude/skills/pytest.rules.md - Save it in the file
plan-pytest.fix_local_tests.mdin the current dir - Do not print anything on screen
Implement and Verify the Fix
- If the root cause and the fix are clear, implement the fixes directly
- If the root cause or the correct fix is unclear, stop and ask the user before implementing anything
- Verify that the fixes work correctly as per
# Verification of the Fixfrom.claude/skills/pytest.rules.md
Verification
- [ ]
plan-pytest.fix_local_tests.mdlists a fix for every failing test - [ ] Every fix follows
# Verification of the Fixin.claude/skills/pytest.rules.md - [ ] The failing tests pass locally after the fix
04 同仓库更多 Skills
Docker 文件同步与模板对齐
tutorial_in_60_mins.propagate_docker_changes
同步教程和课程项目的 Docker 文件,使其与 project_template 保持一致。
Markdown 合并至 Jupyter Notebook
tutorial_in_60_mins.merge_markdown
将 Markdown 文件的内容合并到 Jupyter Notebook 中。
60 分钟教程格式规范化
tutorial_in_60_mins.format
格式化目录,使其遵循「Learn X in 60 Minutes」(60 分钟学会 X)教程约定。
60 分钟教程目录创建
tutorial_in_60_mins.create
按照「Learn X in 60 Minutes」(60 分钟学会 X)约定创建教程目录。
todo.reorg_in_progress
Reorganize ai_task_queue.md so in-progress tasks, not-started tasks, and mislabeled topic headers sit under the right H1 stage
todo.reorg_headers
Reorganize ai_task_queue.md .md so every H2 topic matches ALL TOPICS and every H3 task sits under the right topic, keeping its H1 stage