Skip to content

clayman083/pytest-postgres

Repository files navigation

pytest-postgres: pytest support for PostgreSQL in Docker container

Build Status Coverage Status PyPI version PyPI

pytest-postgres is an plugin for pytest, for adding PostgreSQL database as service into Docker container for tests.

import psycopg2

def test_pg_server(pg_server):
    pg_params = pg_server['pg_params']
    with psycopg2.connect(**pg_params) as conn:
        with conn.cursor() as cursor:
            cursor.execute('SELECT version();')

pytest-postgres has been strongly influenced by pytest-asyncio.

Installation

To install pytest-postgres, do:

(env) $ pip install pytest-postgres

Changelog

0.4.0 (2018-04-03)

Added --pg-network option. [issue](https://github.com/clayman74/pytest-postgres/pull/5)

0.1.1 (2017-07-20)

Repair issue

0.1.0 (2016-09-15)

Initial release.