Python 测试与夹具设计
原名:python-testing-patterns
用 pytest、参数化和合理的模拟覆盖核心逻辑,避免测试依赖真实业务资源。
中文 Skills 技能说明
Python 工具每次更新都要靠手动试一遍时,可让开发岗位数字员工补测试。输入函数、业务规则、已知缺陷和测试配置,技能设计单元、集成测试及夹具,交付测试草稿、运行方法和未覆盖边界。优先使用隔离数据库、临时文件和模拟外部接口,不触发真实付款、发信或生产删除。pytest 等工具需桌面端自行配置;运行和写文件须授权,通过的测试只证明相应场景,合并和上线由人复核证据。
上游能力依据
上游原始适用说明:Implement comprehensive testing strategies with pytest, fixtures, mocking, and test-driven development. Use when writing Python tests, setting up test suites, or implementing testing best practices.
上游 SKILL.md 主要章节(保留原文标题):
- When to Use This Skill
- Core Concepts
- 1. Test Types
- 2. Test Structure (AAA Pattern)
- 3. Test Coverage
- 4. Test Isolation
- Quick Start
- Detailed patterns and worked examples
- Testing Best Practices
- Test Organization
使用边界
先复现问题并固定测试范围,再生成或执行测试。测试通过只能证明已覆盖的场景,不能代替生产环境验收。
作者、翻译与许可证
- 原作者
- Seth Hobson(wshobson)与 agents contributors
- 中文翻译
- CEOFans翻译
- 许可证
- MIT
- 上游来源
- https://github.com/wshobson/agents/tree/46891e7e60da0e52baf1050b7b6391b64e84c6d9/plugins/python-development/skills/python-testing-patterns
适用范围
平台:linux、macos、windows;标签:测试与质量、Python 测试与夹具设计、开源技能
安全提示
基础静态扫描不等于绝对安全。技能可能调用命令、浏览器、云服务或本地文件,请在最小权限环境中使用,高风险操作必须人工确认。
如发现侵权、许可证或安全问题,可在本页前台提交投诉,管理员复核后可立即下架。