testgres is a testing utility for PostgreSQL and its extensions, providing a simple API to manage temporary PostgreSQL instances, create databases, execute queries, and test replication. Current version 1.13.7, PyPI release with monthly cadence.
pip install testgresVerified import paths — ran on the pinned version, not inferred.
Quickstart demonstrating starting a temporary PostgreSQL node, initializing, starting, creating a database, and executing a query.
Use unique names (e.g., with test name or random suffix) for each node.
Specify port range via `port=50432` or use `testgres.get_new_node('node', port=50432)`.Use `node.execute('query', returns='text')` to get string output, or adapt to list-of-tuples.Wrap in try/finally or use `with` context manager which handles cleanup on normal exit, but on exception you may need manual `node.stop()` and `node.cleanup()`.
Run `pip install testgres` and ensure the correct virtual environment is activated.
Ensure you call `node.start()` and wait for readiness, e.g., `node.wait_for_ready()`.
Install PostgreSQL server and ensure its bin directory is in PATH, or set `pg_bindir` parameter to the PostgreSQL bin directory.
No dependency data recorded yet.