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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for postgresfixture-0.5.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bffef4ed2662b7256ca42b41db53d7e587a0fba80729bb7d7b1b994720a014c |
|
MD5 | 107d1ae0460f3e62fb2043a1d651a252 |
|
BLAKE2b-256 | f1f2c174f97f779cc404d1cbf3e0816d9b0b017ed7feab9eb67c18a87b773d97 |