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.
Metadata
Release files for postgresfixture 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| postgresfixture-0.5.0.tar.gz | 13.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| postgresfixture-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.5 kB
Release files / postgresfixture-0.5.0.tar.gz
| Download URL | postgresfixture-0.5.0.tar.gz |
|---|---|
| Size | 13.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b78ca21dd6ac0e6b3cf0081b78d3b4498bfb69026d303466d24f7714efb8e35
|
|
BLAKE2b-256 checksum How to use checksums |
5e82fcbb90c9b38572302f75f5fd2cd08e9dfdb80a52db0838dc257e3ae74ff6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Release files / postgresfixture-0.5.0-py3-none-any.whl
| Download URL | postgresfixture-0.5.0-py3-none-any.whl |
|---|---|
| Size | 17.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6bffef4ed2662b7256ca42b41db53d7e587a0fba80729bb7d7b1b994720a014c
|
|
BLAKE2b-256 checksum How to use checksums |
f1f2c174f97f779cc404d1cbf3e0816d9b0b017ed7feab9eb67c18a87b773d97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|