py-integration-test

Run integration tests against real PostgreSQL and Redis services with testcontainers.

3|Updated Mar 22, 2026
One-click install
npx skills add https://github.com/vndee/engineering-skills --skill py-integration-test
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: py-integration-test
Source: https://github.com/vndee/engineering-skills/tree/main/.claude/skills/py-integration-test
Command: npx skills add https://github.com/vndee/engineering-skills --skill py-integration-test

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Integration tests for Python/FastAPI services often require real external dependencies (PostgreSQL, Redis, and others) to ensure end-to-end correctness across the stack.

Core Features & Use Cases

  • Spin up real containers for Postgres, Redis, and related services during tests using testcontainers-python.
  • Provide reusable pytest fixtures that simplify lifecycle management, migrations, and transactional isolation.
  • Validate business logic across repository, API, and migrations with confidence in production-like environments.

Quick Start

Install the required tooling and use the provided fixtures to run integration tests against real services.

Frequently Asked Questions about py-integration-test

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

FAQPage Schema
How do I run integration tests for FastAPI with real PostgreSQL and Redis?

You can run integration tests for FastAPI by spinning up real PostgreSQL and Redis instances using testcontainers-python, validating repository layers and end-to-end HTTP flows with production-like dependencies. Reusable pytest fixtures manage the container lifecycles and database migrations automatically.

What is the best way to isolate database transactions during pytest integration testing?

The best way to isolate database transactions during pytest integration testing is to use reusable fixtures that wrap each test in a transactional scope. This ensures tests roll back automatically, maintaining database state isolation against real PostgreSQL instances.

Does testcontainers work with async SQLAlchemy for Python integration tests?

Yes, testcontainers works with async SQLAlchemy for Python integration tests by provisionally starting a real PostgreSQL container. The provided pytest fixtures handle the async engine configuration to validate business logic against a live database.

Why should I use real dependencies instead of mocks for Python service testing?

You should use real dependencies instead of mocks for Python service testing to ensure end-to-end correctness across the stack. Testing against real PostgreSQL and Redis services validates repository logic, API flows, and migrations with high confidence in production-like environments.

Can I automate database migration testing using pytest and testcontainers?

Yes, you can automate database migration testing using pytest and testcontainers by spinning up a real PostgreSQL container per test session. The fixtures apply migrations to verify schema changes and data integrity against a live database instance.

Do I need Docker installed to run integration tests with testcontainers?

Yes, you need Docker installed to run integration tests with testcontainers because the framework dynamically provisions and tears down real PostgreSQL and Redis containers during the pytest execution lifecycle.