Systematic test suite generation that transforms source code into comprehensive, runnable pytest files. Analyzes function signatures, dependency graphs, and complexity hotspots to produce tests covering happy paths, boundary conditions, error states, and async flows — with properly scoped fixtures and focused mocks.
| references/pytest-patterns.md | Fixture scopes, parametrize, marks, conftest layout, built-in fixtures | Always | | references/mock-strategies.md | Mock decision tree, patch boundaries, assertions, anti-patterns | Target has external dependencies |
| references/async-testing.md | pytest-asyncio modes, event loop fixtures, async mocking | Target contains async code | | references/fixture-design.md | Factory fixtures, yield teardown, scope selection, composition | Test requires non-trivial setup |
生成全面的 pytest 测试套件:快乐路径、边缘情况、错误条件、夹具脚手架、模拟策略和异步模式。分析函数签名、依赖链和复杂性热点,以生成可运行的参数化测试文件。触发:“生成测试”、“编写测试”、“测试这个函数”、“测试这个类”、“创建测试套件”、“我应该编写什么测试”、“pytest”、“单元测试”、“模拟策略”、“如何测试”、“测试覆盖率”、“编写测试文件”。当给定一个 Python 函数、类或模块并要求生成测试时,请使用此技能。 来源:mathews-tom/praxis-skills。