闲社服务运行正常AI智能体自动化平台
p

pytest代码审查

技能标识:pytest-code-review

Reviews pytest test code for async patterns, fixtures, parametrize, and mocking. Use when reviewing test_*.py files, checking async test functions, fixture usage, or mock patterns.

作者:admin | 来源记录:ClawHub
登记来源
ClawHub
版本
V 1.1.0
检测标记
后台标记通过
免费
免费获取
0
收藏
来源与检测标记为平台登记信息,并不代表已展示可复核的检测报告。使用前请核对版本、依赖和所需权限,建议先在隔离环境中运行。
概述
安装方式
版本历史

pytest代码审查

技能名称: pytest-code-review

详细描述:

Pytest 代码审查

快速参考

问题类型参考文档
async def test*、AsyncMock、await 模式references/async-testing.md
conftest.py、工厂夹具、作用域、清理
references/fixtures.md | | @pytest.mark.parametrize、DRY 模式 | references/parametrize.md | | AsyncMock 追踪、patch 模式、何时模拟 | references/mocking.md |

审查清单

  • - [ ] 测试函数使用 async def test* 来测试异步代码
  • [ ] 对异步依赖使用 AsyncMock,而非 Mock
  • [ ] 所有异步模拟和协程都被 await 等待
  • [ ] 共享设置使用 conftest.py 中的夹具
  • [ ] 夹具作用域适当(函数、类、模块、会话)
  • [ ] 带 yield 的夹具在 finally 块中有正确的清理
  • [ ] 对相似测试用例使用 @pytest.mark.parametrize
  • [ ] 多个测试函数之间没有重复的测试逻辑
  • [ ] 模拟正确追踪调用(assertcalledoncewith)
  • [ ] patch() 定位正确的位置(在使用处,而非定义处)
  • [ ] 不模拟应被测试的内部实现
  • [ ] 测试隔离(测试之间没有共享的可变状态)

何时加载参考文档

  • - 审查异步测试函数 → async-testing.md
  • 审查夹具或 conftest.py → fixtures.md
  • 审查相似测试用例 → parametrize.md
  • 审查模拟和补丁 → mocking.md

审查问题

  1. 1. 所有异步函数是否都使用 async def test_* 进行测试?
  2. 夹具是否具有适当的作用域和正确的清理?
  3. 相似测试用例能否参数化以减少重复?
  4. 模拟是否追踪调用并在正确的位置使用?

标签

skill ai

通过对话安装

以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 pytest-code-review-1776088089 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 pytest-code-review-1776088089 技能

通过命令行安装

skillhub install pytest-code-review-1776088089

下载

⬇ 下载 pytest-code-review v1.1.0(免费)

文件大小: 11.02 KB | 发布时间: 2026-4-14 14:34

v1.1.0 最新 2026-4-14 14:34
pytest-code-review 1.1.0

- Added a detailed review checklist for pytest async tests, fixtures, parametrization, and mocking.
- Introduced clear references for async patterns, fixtures, parametrize, and mocking topics.
- Provided guidance on when to load specific reference materials.
- Included review questions to guide thoughtful code analysis.
返回顶部