Building the product · Edition No. 18 · 12 Sep 2026

testcontainers/testcontainers-python

Tests get a real, empty PostgreSQL started in a container and thrown away afterwards.

← Building the productRead the whole edition →

2.2k stars · Apache-2.0 · 4.15.0 on PyPI (2026-07-24); GitHub's newest tag is testcontainers-v4.15.0 (2026-07-24) and a v4.15.0-rc4 candidate sits above it

Tests get a real, empty PostgreSQL started in a container and thrown away afterwards.

Repo detailsthe review · specs · pros & cons · install

What it is

Testcontainers for Python is a library you add to your test code. It starts real services inside Docker containers for the duration of a test run, hands your code the address to connect to, and removes them when the run ends.What it is good for. Anyone with a real database behind their app who has been putting off writing tests. The usual shortcut is to test against SQLite, a small file-based database, and hope it behaves like the real one. It does not, and the differences show up in production. Grasppy is FastAPI and PostgreSQL, so this is the piece that lets Claude Code write tests that actually prove something. It also sits neatly beside pglite from yesterday's edition: pglite gives a browser a Postgres engine with no server, and this gives a test run the real server in a throwaway container.

Stars2.2k
LicenceApache-2.0
Latest4.15.0 on PyPI (2026-07-24); GitHub's newest tag is testcontainers-v4.15.0 (2026-07-24) and a v4.15.0-rc4 candidate sits above it
Good
  • Tests run against the same database engine as production, so a passing test means more.
  • Each run starts empty, so tests cannot pollute each other or leave rubbish behind.
  • It supports far more than databases. Redis, message queues and object storage all work the same way.
Watch for
  • Every test run pulls and starts containers, so the first run is slow and the rest add a few seconds each.
  • It needs Docker available wherever the tests run, including on any build machine you use later.
  • The latest release on GitHub is a release candidate, which is a version offered for testing. Install from PyPI, where 4.15.0 is the finished release.
Install
cd ~/grasppy
source venv/bin/activate
pip install "testcontainers[postgres]" pytest

Get the next edition in your inbox

A dozen repositories, opened and checked. The licence read, the last release dated, and the ones that did not make it named with the reason. It is the half most lists leave out.

No tracking pixels. One click to leave. The archive stays free either way.

We use your address to send the edition and nothing else. Confirm by email, leave in one click. How we handle it.