python-testing

Generate and fix pytest test code for Python projects.

7|Updated Apr 7, 2026
One-click install
npx skills add https://github.com/chenziyang110/spec-kit-plus --skill python-testing-chenziyang110
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-testing
Source: https://github.com/chenziyang110/spec-kit-plus/tree/main/templates/passive-skills/python-testing
Command: npx skills add https://github.com/chenziyang110/spec-kit-plus --skill python-testing-chenziyang110

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you write, fix, and improve Python tests using pytest so you can catch regressions quickly and diagnose failures with clear, repeatable checks.

Core Features & Use Cases

  • pytest-based test generation: creates unit and integration tests for Python code, aligned to common project layouts and naming conventions.
  • Failure and flakiness diagnosis: provides a structured approach to reproducing issues, isolating nondeterminism, and using the right tools for async and time-sensitive behavior.
  • Coverage and configuration guidance: recommends pytest configuration and execution commands to support CI gating and coverage improvements.

Use case: You changed a Python utility function and a previously passing test suite now fails intermittently in CI; this Skill helps you generate targeted tests, add the missing fixtures/mocks, and stabilize async or time-dependent assertions.

Quick Start

Ask the AI to: "Write pytest tests for the failing Python module, including any needed fixtures and a pytest execution command for quick verification."

Frequently Asked Questions about python-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate pytest tests for a Python module?

To generate pytest tests, provide your target Python module to produce aligned unit and integration tests, complete with necessary fixtures and execution commands for immediate verification.

Why does my pytest suite fail intermittently in CI and how do I fix flaky tests?

To fix flaky tests, you isolate nondeterminism by reproducing issues and applying targeted mocking or tmp_path strategies, ensuring your async and time-sensitive assertions become deterministic.

How do I write pytest tests for asyncio behavior?

Writing pytest tests for asyncio behavior involves selecting appropriate mocking strategies and applying structured failure diagnosis to stabilize asynchronous and time-dependent test assertions.

What is the best way to improve test coverage and configure pytest for CI gating?

Improving test coverage and configuring pytest for CI gating requires recommending specific pytest configurations and execution commands that support regression protection and enforce coverage thresholds.

Does pytest test generation work with existing project layouts and naming conventions?

Pytest test generation works with existing project layouts by following standard test discovery patterns, ensuring newly generated unit and integration tests integrate cleanly into your current suite.