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
File details
Details for the file postgresfixture-0.5.0.tar.gz
.
File metadata
- Download URL: postgresfixture-0.5.0.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b78ca21dd6ac0e6b3cf0081b78d3b4498bfb69026d303466d24f7714efb8e35 |
|
MD5 | 2a8be46c2d334732142fa4ed9bf48183 |
|
BLAKE2b-256 | 5e82fcbb90c9b38572302f75f5fd2cd08e9dfdb80a52db0838dc257e3ae74ff6 |
File details
Details for the file postgresfixture-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: postgresfixture-0.5.0-py3-none-any.whl
- Upload date:
- Size: 17.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bffef4ed2662b7256ca42b41db53d7e587a0fba80729bb7d7b1b994720a014c |
|
MD5 | 107d1ae0460f3e62fb2043a1d651a252 |
|
BLAKE2b-256 | f1f2c174f97f779cc404d1cbf3e0816d9b0b017ed7feab9eb67c18a87b773d97 |