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.dropdb("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.4.3.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

postgresfixture-0.4.3-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: postgresfixture-0.4.3.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.4

File hashes

Hashes for postgresfixture-0.4.3.tar.gz
Algorithm Hash digest
SHA256 be27e061e81ef4e061b91367d4b0073a98cca3e934a04951acc35a1ef4a6b60d
MD5 e21dde3bf8e2e79577b6b1a24f643401
BLAKE2b-256 a37bd50057c9ed34e475bceb3c6b10c10e18d2cfe1b69a298629bf706a0e5fbe

See more details on using hashes here.

File details

Details for the file postgresfixture-0.4.3-py3-none-any.whl.

File metadata

  • Download URL: postgresfixture-0.4.3-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.4

File hashes

Hashes for postgresfixture-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 90648264912c8c5e426eac8b5da20e9e53708dca4d1a88c4c268e68b5ea86544
MD5 4318294e339ecf0a3979c3a6543f2da8
BLAKE2b-256 e25bf6cee84439eb7e8a9eb8d82fa12b99818a7d3497e4c1a8835ff68ba167b2

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