skillfed

testing.postgresql

automatically setups a postgresql instance in a temporary directory, and destroys it after testing

testing-postgresql v1.3.0 4.5M downloads/30d#2,293 on PyPI293
Permissive license Apache License 2.0 Abandoned released

What it is and what it does

testing.postgresql is a test fixture library that spawns isolated PostgreSQL instances in temporary directories for the duration of a test run, then cleans them up automatically. It wraps the PostgreSQL command-line tools (initdb and postgres) to create fresh databases on demand, eliminating the need to manage shared test databases or mock database connections.

The package provides two main patterns: direct instantiation via Postgresql() for simple per-test isolation, or PostgresqlFactory with caching to reuse an initialized database schema across multiple tests, reducing setup overhead. It integrates with standard unittest patterns and supports passing connection details to database drivers via url() or dsn() methods.

Use it for:

  • Unit tests that need real PostgreSQL behavior without a shared test database.
  • Integration tests that require schema fixtures and data isolation between test cases.
  • CI/CD pipelines where PostgreSQL must be provisioned and torn down per test run.
  • Development workflows testing database migrations or schema changes in isolation.
  • Parameterized tests that each need a fresh database state without manual setup code.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Automatically creates and tears down temporary PostgreSQL instances for testing, handling setup and cleanup without manual intervention.

No. The package is abandoned (latest release 2016-02-04) and targets Python 2.6, 2.7, 3.2, 3.3, 3.4, 3.5—all end-of-life versions. Modern Python and PostgreSQL compatibility are untested. For new projects, consider actively maintained alternatives.

Install

testing-postgresql on PyPI

pip

pip install testing-postgresql

uv

uv add testing-postgresql

poetry

poetry add testing-postgresql

Installing testing.postgresql

Before you install

Low install friction with a pure-Python wheel distribution. However, the package is abandoned as of 2016 with no updates since its latest release, and its last commit was in 2023. The codebase targets Python 2.6, 2.7, 3.2, 3.3, 3.4, 3.5, all of which are end-of-life; compatibility with modern Python versions is unverified.

License in practice

Licensed under Apache License 2.0, a permissive license that allows commercial and private use with minimal restrictions. No licensing barrier to adoption.

Quickstart

import testing.postgresql

with testing.postgresql.Postgresql() as postgresql:
    # connect using postgresql.url() or postgresql.dsn()
    # run tests

PostgreSQL server binaries (initdb, postgres) must be present in your PATH; the package does not bundle them.

Verify before relying

  • Compatibility with Python versions beyond 3.5 is not documented.
  • Whether the package works with modern PostgreSQL versions is unclear.
  • Current state of the testing.common.database dependency introduced in 1.3.0.
  • Whether pg8000 1.10 dependency remains compatible with current environments.

Package facts

License Apache License 2.0 (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance abandoned — 3,844 days since the last release
Last repo commit
First released
Downloads 4,479,309/month — #2,293 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: testing.postgresql-1.3.0-py2.py3-none-any.whl

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: PythonProgramming Language :: Python :: 2.6Programming Language :: Python :: 2.7Programming Language :: Python :: 3.2Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Topic :: DatabaseTopic :: Software DevelopmentTopic :: Software Development :: Testing

Tags

postgresql test fixturestemporary database for testingautomated postgres setuppostgres test isolationdatabase testing utilitiesephemeral postgres instances
database-testingtest-fixturesabandoned

More Software Development packages