testing-python

Generate pytest tests covering unit, integration, and async patterns.

6|Updated Dec 7, 2025
One-click install
npx skills add https://github.com/timequity/plugins --skill testing-python
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-python
Source: https://github.com/timequity/plugins/tree/main/craft-coder/testing-python
Command: npx skills add https://github.com/timequity/plugins --skill testing-python

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

A guide to modern Python testing using pytest, with best practices for unit, integration, and async tests.

Core Features & Use Cases

  • Tooling & Patterns: Pytest, pytest-asyncio, pytest-mock, Hypothesis, Respx/httpx, aioresponses.
  • Directory Structure: Guidance on organizing tests (unit/integration).
  • Best Practices: Coverage, fixtures, mocks.

Quick Start

Install dev testing tools and start writing tests for your codebase.

Frequently Asked Questions about testing-python

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

FAQPage Schema
How do I write unit tests for Python code using pytest?

Pytest is a testing framework that lets you write simple test functions with assertions. Create test files prefixed with `test_`, write functions named `test_*`, and run `pytest` to execute them. The Skill covers unit test patterns, fixtures, and best practices for organizing tests across your codebase.

How do I test async Python functions with pytest?

Use pytest-asyncio to run asynchronous tests. Mark test functions with `@pytest.mark.asyncio` and await async code directly in tests. This Skill provides patterns for async test setup, fixtures, and integration with fixtures for async-based projects.

What's the best way to mock HTTP requests in Python tests?

Mock HTTP calls using httpx with tools like Respx or aioresponses to avoid hitting real endpoints. Pytest-mock and these libraries let you stub responses, verify requests, and test error handling. This Skill covers HTTP mocking patterns and configuration for both sync and async code.

How do I organize and structure test files in a Python project?

Organize tests in a dedicated `tests/` directory with subdirectories for unit and integration tests. Use conftest.py for shared fixtures and configuration. This Skill provides directory structure guidance, fixture patterns, and pytest configuration to scale testing across projects.

Can I use pytest with parametrized tests and custom markers?

Yes. Pytest supports parametrization to run the same test with multiple inputs using `@pytest.mark.parametrize`, and custom markers to categorize and filter tests. This Skill covers parametrization patterns, marker setup, and test naming conventions for maintainable test suites.

How do I measure test coverage and enforce it in Python projects?

Coverage tools measure which code paths tests execute. Configure pytest with coverage plugins and set coverage thresholds in your CI/CD pipeline. This Skill includes coverage tooling setup, configuration examples, and best practices for maintaining high coverage standards.