1
1
mirror of https://github.com/dbcli/pgcli.git synced 2024-10-06 02:07:53 +03:00
pgcli/tests/conftest.py
Iryna Cherniavska 9a35e5ef05 Started adding "service" option. Connect #289.
Switched to dsn-based approach (no config parsing).
2015-08-13 23:40:11 -07:00

27 lines
615 B
Python

import pytest
from utils import (POSTGRES_HOST, POSTGRES_USER, create_db, db_connection,
drop_tables)
import pgcli.pgexecute
@pytest.yield_fixture(scope="function")
def connection():
create_db('_test_db')
connection = db_connection('_test_db')
yield connection
drop_tables(connection)
connection.close()
@pytest.fixture
def cursor(connection):
with connection.cursor() as cur:
return cur
@pytest.fixture
def executor(connection):
return pgcli.pgexecute.PGExecute(database='_test_db', user=POSTGRES_USER,
host=POSTGRES_HOST, password=None, port=None, dsn=None)