跳到正文
cccskills
免费在 GitHub 公开

python-testing

Python testing patterns with pytest, fixtures, TDD, mocking, async and integration tests. Use when writing or auditing a Python test suite.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(7)

  • SKILL.md3.1 KB
  • modules/async-testing.md4.4 KB
  • modules/fixtures-and-mocking.md4.0 KB
  • modules/test-infrastructure.md2.9 KB
  • modules/test-quality.md3.4 KB
  • modules/testing-workflows.md2.9 KB
  • modules/unit-testing.md1.9 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Python Testing Hub

Testing standards for pytest configuration, fixture management, and TDD implementation.

Quick Start

  1. Dependencies: pip install pytest pytest-cov pytest-asyncio pytest-mock
  2. Configuration: Add the following to pyproject.toml:
    [tool.pytest.ini_options]
    testpaths = ["tests"]
    addopts = "--cov=src"
    
  3. Verification: Run pytest to confirm discovery of files matching test_*.py.

When To Use

  • Constructing unit and integration tests for Python 3.9+ projects.
  • Isolating external dependencies using pytest-mock or custom monkeypatching.
  • Validating asynchronous logic with pytest-asyncio markers and event loop management.
  • Configuring project-wide coverage thresholds and reporting.

When NOT To Use

  • Evaluating test quality - use pensive:test-review instead
  • Infrastructure test config - use leyline:pytest-config

Modules

This skill uses modular loading to manage the system prompt budget.

Core Implementation

  • See modules/unit-testing.md - AAA (Arrange-Act-Assert) pattern, basic test structure, and exception validation.
  • See modules/fixtures-and-mocking.md - Request-scoped fixtures, parameterization, and boundary mocking.
  • See modules/async-testing.md - Coroutine testing, async fixtures, and concurrency validation.

Infrastructure & Workflow

  • See modules/test-infrastructure.md - Directory standards, conftest.py management, and coverage tools.
  • See modules/testing-workflows.md - Local execution patterns and GitHub Actions integration.

Standards

  • See modules/test-quality.md - Identification of common anti-patterns like broad exception catching or shared state between tests.

Exit Criteria

  • Tests implement the AAA pattern.
  • Coverage reaches the 80% project minimum.
  • Individual tests are independent and do not rely on execution order.
  • Fixtures are scoped appropriately (function, class, or session) to prevent side effects.
  • Mocking is restricted to external system boundaries.

Troubleshooting

  • Test Discovery: Verify filenames match the test_*.py pattern. Use pytest --collect-only to debug discovery paths.
  • Import Errors: Ensure the local source directory is in the path, typically by installing in editable mode with pip install -e ..
  • Async Failures: Confirm that pytest-asyncio is installed and that async tests use the @pytest.mark.asyncio decorator or corresponding auto-mode configuration.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Shapes turns action-first: action leads, steps numbered, state restated. Use for ADHD-friendly output. Do not use to trim tokens; use response-compression.

中文简介正在准备中。当前显示原文说明。

athola/claude-night-market3422026年10月17日 更新

Inverts burden of proof for code additions. Use when reviewing PRs, planning refactors, or running unbloat to challenge every addition's necessity.

中文简介正在准备中。当前显示原文说明。

athola/claude-night-market3422026年10月17日 更新

Tracks per-agent token usage and flags waste in parallel dispatch. Use when evaluating parallel agent efficiency or after a multi-agent run.

中文简介正在准备中。当前显示原文说明。

athola/claude-night-market3422026年10月17日 更新

Coordinates Claude agent teams via filesystem protocol. Use when orchestrating parallel agents with task dependencies. Do not use for single-agent tasks.

中文简介正在准备中。当前显示原文说明。

athola/claude-night-market3422026年10月17日 更新

Evaluates API surface design, consistency, and exemplar alignment. Use when reviewing public API changes or before releasing a new API surface.

中文简介正在准备中。当前显示原文说明。

athola/claude-night-market3422026年10月17日 更新

Selects architecture paradigm via research before scaffolding. Use when architecture is undecided and the choice needs justification and documentation.

中文简介正在准备中。当前显示原文说明。

athola/claude-night-market3422026年10月17日 更新

查看 athola 的全部技能

报告此技能的问题