Skip to main content

A fixture for creating PostgreSQL clusters and databases, and tearing them down again, intended for use during development and testing.

Project description

A Python fixture for creating PostgreSQL clusters and databases, and tearing them down again, intended for use during development and testing.

For more information see the Launchpad project page.

Getting started

Use like any other fixture:

from contextlib import closing
from postgresfixture import ClusterFixture

def test_something(self):
    cluster = self.useFixture(ClusterFixture("db"))
    cluster.createdb("example")
    with closing(cluster.connect("example")) as conn:
        ...
    cluster.dropbdb("example")  # Optional.

This will create a new cluster, create a database called “example”, then tear it all down at the end; nothing will remain on disk. If you want the cluster and its databases to remain on disk, pass preserve=True to the ClusterFixture constructor.

From the command line

Once this package is installed, you’ll have a postgresfixture script. Alternatively you can use python -m postgresfixture to achieve the same thing. Use --help to discover the options available to you.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

postgresfixture-0.1.tar.gz (5.7 kB view details)

Uploaded Source

File details

Details for the file postgresfixture-0.1.tar.gz.

File metadata

  • Download URL: postgresfixture-0.1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for postgresfixture-0.1.tar.gz
Algorithm Hash digest
SHA256 a34c0dd9b8e53504631e219d8926e478eb369266b3c6b58dc40bfaf48e490950
MD5 a4a31d3ef32c43f8b701620a9b8b6067
BLAKE2b-256 9369518e7ad7815073a545f58982ada220dfc914ae3a026d68c45d242b34ad96

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page