{"repo":"postgrespro/testgres","free":true,"listed":false,"github":"https://github.com/postgrespro/testgres","clone":"git clone https://github.com/postgrespro/testgres.git","description":"Testing framework for PostgreSQL and its extensions","language":"Python","stars":157,"topics":["postgresql","postgres","testing","replication","testgres","pathman"],"license":null,"category":"databases-storage","readme_excerpt":"Documentation testgres Utility for orchestrating temporary PostgreSQL clusters in Python tests. Supports Python 3.7.3 and newer. Installation Install testgres from PyPI: Use a dedicated virtual environment for isolated test dependencies. Usage Environment Note: by default testgres invokes initdb , pg ctl , and psql binaries found in PATH . Specify a custom PostgreSQL installation in one of the following ways: - Set the PG CONFIG environment variable to point to the pg config executable. - Set the PG BIN environment variable to point to the directory with PostgreSQL binaries. Example: Examples Create a temporary node, run queries, and let testgres clean up automatically: Query helpers testgres provides four helpers for executing queries against the node: Command Description --------- ------------- node.psql(query, ...) Runs the query via psql and returns a tuple (returncode, stdout, stderr) . node.safe psql(query, ...) Same as psql() but returns only stdout and raises if the command fails. node.execute(query, ...) Connects via psycopg2 or pg8000 (whichever is available) and returns a list of tuples. node.connect(dbname, ...) Returns a NodeConnection wrapper for executing multiple statements within a transaction. Example of transactional usage: Logging By default cleanup() removes all temporary files (data directories, logs, and so on) created by the API. Call configure testgres(node cleanup full=False) before starting nodes if you want to keep logs for inspection. Note: contex","default_branch":null,"files":null,"tree":[],"storefront":"/r/postgrespro","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/postgrespro/testgres/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}