什么是 pytest-mocking-strategy?
掌握 pytest 的模拟策略:何时使用 autospec=True 与手动模拟、异步代码的 AsyncMock 模式、模拟构建器和工厂,以及永远不应该模拟的内容。包括类型安全的模拟创建模式和模拟与真实对象的决策矩阵。 使用时机:使用模拟依赖项创建单元测试,决定是模拟还是使用真实对象,设置测试隔离,使用外部服务边界测试用例,或构建可重用的模拟工厂。 来源:dawiddutoit/custom-claude。
掌握 pytest 的模拟策略:何时使用 autospec=True 与手动模拟、异步代码的 AsyncMock 模式、模拟构建器和工厂,以及永远不应该模拟的内容。包括类型安全的模拟创建模式和模拟与真实对象的决策矩阵。 使用时机:使用模拟依赖项创建单元测试,决定是模拟还是使用真实对象,设置测试隔离,使用外部服务边界测试用例,或构建可重用的模拟工厂。
通过命令行快速安装 pytest-mocking-strategy AI 技能到你的开发环境
来源:dawiddutoit/custom-claude。
Mocking is essential for unit testing, but over-mocking creates brittle tests that fail on refactoring. This skill provides a comprehensive framework for deciding what to mock, how to mock it safely, and when to use real objects instead.
Use when deciding what to mock in tests with "create mock", "mock external service", "AsyncMock pattern", or "what should I mock".
Do NOT use for domain testing (never mock domain objects), pytest configuration (use pytest-configuration), or test factories (use pytest-test-data-factories). Quick Start
掌握 pytest 的模拟策略:何时使用 autospec=True 与手动模拟、异步代码的 AsyncMock 模式、模拟构建器和工厂,以及永远不应该模拟的内容。包括类型安全的模拟创建模式和模拟与真实对象的决策矩阵。 使用时机:使用模拟依赖项创建单元测试,决定是模拟还是使用真实对象,设置测试隔离,使用外部服务边界测试用例,或构建可重用的模拟工厂。 来源:dawiddutoit/custom-claude。
为搜索与 AI 引用准备的稳定字段与命令。
npx skills add https://github.com/dawiddutoit/custom-claude --skill pytest-mocking-strategy掌握 pytest 的模拟策略:何时使用 autospec=True 与手动模拟、异步代码的 AsyncMock 模式、模拟构建器和工厂,以及永远不应该模拟的内容。包括类型安全的模拟创建模式和模拟与真实对象的决策矩阵。 使用时机:使用模拟依赖项创建单元测试,决定是模拟还是使用真实对象,设置测试隔离,使用外部服务边界测试用例,或构建可重用的模拟工厂。 来源:dawiddutoit/custom-claude。
打开你的终端或命令行工具(如 Terminal、iTerm、Windows Terminal 等) 复制并运行以下命令:npx skills add https://github.com/dawiddutoit/custom-claude --skill pytest-mocking-strategy 安装完成后,技能将自动配置到你的 AI 编程环境中,可以在 Claude Code、Cursor 或 OpenClaw 中使用
https://github.com/dawiddutoit/custom-claude