Installation#
pytest-databases requires Python 3.11 or later.
uv add --dev pytest-databases
pip install pytest-databases
pdm add --dev pytest-databases
poetry add --group dev pytest-databases
All *_service container fixtures check readiness with Python’s standard library or with tools bundled inside the
container image, so the base package does not install any database driver. Install the client library your application
already uses alongside pytest-databases.
Embedded PostgreSQL#
The embedded PostgreSQL service runs local initdb / postgres binaries instead of a container. The
embedded-postgres extra installs them (pgembed on Python 3.12+, pgserver on Python 3.11); without it the
service uses PostgreSQL from PG_BIN_DIR, the PATH, or pg_config --bindir.
uv add --dev "pytest-databases[embedded-postgres]"
pip install "pytest-databases[embedded-postgres]"
pdm add --dev "pytest-databases[embedded-postgres]"
poetry add --group dev "pytest-databases[embedded-postgres]"
Optional Extras#
The extras below remain for projects that pin pytest-databases[<extra>]. Apart from embedded-postgres, none of
them is needed by a *_service fixture; the ones that install a package only pull in a client for your own tests or
for a deprecated client fixture.
Extra |
Installs |
Notes |
|---|---|---|
|
|
Same contents. |
|
|
Used by the deprecated |
|
|
PostgreSQL server binaries for |
|
|
Used by the deprecated |
|
|
Used by the deprecated PostgreSQL-family |
|
|
Same contents. |
|
|
Used by the deprecated |
|
nothing |
Installed a driver in v0.19.0 ( |
|
nothing |
Empty since v0.19.0. |
Providers without an extra (Db2, Dolt, Floci, LocalStack, MinIO, Pub/Sub, RabbitMQ, Redpanda, RustFS, Snowflake, and the rest) only need the base package.