testing-python
Debug and fix Python test failures using pytest with disciplined isolation, minimal changes, and regression prevention.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- name
- testing-python
- description
- Debug and fix Python test failures using pytest with disciplined isolation, minimal changes, and regression prevention.
03 SKILL.md 正文
Steps
- Reproduce the failure locally with
pytest -x(or a targeted file/test viapytest path/to/test.py -k name). - Read the failing assertion/traceback carefully and identify the exact behavior mismatch (not just the symptom).
- Locate the responsible code path by searching for referenced functions/classes/log strings (use
rg, orgrep -Rifrgis unavailable). - Implement the smallest behavior change that satisfies the failing test without changing public lifecycle semantics that other tests rely on.
- In particular, avoid “helpful” implicit behavior in global entry points (e.g., auto-starting sessions in
init()), because it can create cross-test state and break expectations. - If failures relate to global/singleton state, prefer resetting/clearing state at the correct boundary (or making operations no-op-safe) rather than starting work implicitly.
- In particular, avoid “helpful” implicit behavior in global entry points (e.g., auto-starting sessions in
- Validate against regressions:
- Run the originally failing test(s).
- Then run the full suite to ensure no new failures/warnings were introduced (watch for repeated warnings indicating state leakage).
- When preparing patch files, generate diffs from the repo to avoid corrupt hunks:
- Make edits normally, then use
git diff > patch_1.diff(or similar) so headers/hunk counts are correct. - Optionally sanity-check with
git apply --check patch_1.diffbefore applying.
- Make edits normally, then use
Expected Result
A fix that makes the failing test(s) pass while keeping the rest of the suite stable (no new failures due to singleton/stateful side effects), delivered as valid unified diffs.
04 同仓库更多 Skills
video-frame-extraction
Extract frames from video files and save them as images using OpenCV
openai-vision
Analyze images and multi-frame sequences using OpenAI GPT vision models
image-ocr
Extract text content from images using Tesseract OCR via Python, including structured field extraction from receipts and forms
video-frame-extraction
Extract frames from video files and save them as images using OpenCV
openai-vision
Analyze images and multi-frame sequences using OpenAI GPT vision models
image-ocr
Extract text content from images using Tesseract OCR via Python, including structured field extraction from receipts and forms