Skip to main content

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)

Source distribution for postgresfixture 0.5.0
File Size Uploaded
postgresfixture-0.5.0.tar.gz 13.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for postgresfixture 0.5.0
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.3

2 release files

0.4.2

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.1

1 release file

0.3

1 release file

0.2.1

1 release file

0.2

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page