python-testing

Build pytest suites with fixtures, parametrized cases, and async tests.

6|1|Updated Mar 30, 2026
One-click install
npx skills add https://github.com/wesleyosantos91/multi-agents --skill python-testing-wesleyosantos91
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-testing
Source: https://github.com/wesleyosantos91/multi-agents/tree/main/devin/.devin/skills/python-testing
Command: npx skills add https://github.com/wesleyosantos91/multi-agents --skill python-testing-wesleyosantos91

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you create and improve Python test suites so you can catch regressions early and measure code coverage with confidence.

Core Features & Use Cases

  • Fixtures and test architecture: Build reusable conftest.py fixtures, including real DB setup via Testcontainers and service wiring for FastAPI.
  • Parameterized and async testing: Use parametrize to cover multiple cases and pytest.mark.asyncio for async endpoints.
  • Mocking and exception assertions: Apply AsyncMock and patch for external dependencies and validate failure paths with pytest.raises.
  • Integration tests with Testcontainers: Run repository-level tests against a real PostgreSQL instance to validate persistence behavior.
  • Coverage-oriented commands and checklists: Standardize how you run unit vs integration tests and how you generate coverage reports.

Quick Start

Use the python-testing skill to generate a complete pytest plan and example tests for a FastAPI endpoint with PostgreSQL integration using Testcontainers and async HTTP requests.

Frequently Asked Questions about python-testing

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

FAQPage Schema
How do I write pytest tests for FastAPI endpoints with async database connections?

You can write pytest tests for FastAPI endpoints by using AsyncClient for async HTTP requests, applying pytest.mark.asyncio, and overriding FastAPI dependencies. Reusable conftest.py fixtures handle DB setup via Testcontainers for real PostgreSQL integration testing.

What is the best way to structure reusable pytest fixtures for integration testing?

Structuring reusable pytest fixtures involves creating a conftest.py file to manage service wiring and database setup. Using Testcontainers provides a real PostgreSQL instance for repository-level integration tests, ensuring persistent behavior validation without manual mock databases.

How do I mock external dependencies in async Python tests?

Mock external dependencies in async Python tests by applying AsyncMock and patch. This isolates external service calls, while pytest.raises validates failure paths and exception assertions, ensuring your test suite accurately captures error handling.

Can I use Testcontainers to run pytest integration tests against a real PostgreSQL database?

Yes, you can use Testcontainers to run pytest integration tests against a real PostgreSQL database. This approach validates actual persistence behavior at the repository level, providing reliable integration testing without maintaining manual database mocks.

How do I measure code coverage and separate unit tests from integration tests in pytest?

Measure code coverage and separate tests by applying clear pytest markers for integration separation. Standardize coverage commands to generate reports, running unit and integration tests independently to ensure precise coverage tracking for your Python application.