bjmc / pytest-postgres

pytest support for PostgreSQL in Docker container.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

pytest support for PostgreSQL in Docker container.

License:MIT License


Languages

Language:Python 84.8%Language:Makefile 15.2%