2015-01-08 00:30:20 +03:00
|
|
|
import pytest
|
2015-01-31 05:59:09 +03:00
|
|
|
from utils import (POSTGRES_HOST, POSTGRES_USER, create_db, db_connection,
|
|
|
|
drop_tables)
|
|
|
|
import pgcli.pgexecute
|
2015-01-08 00:30:20 +03:00
|
|
|
|
|
|
|
|
|
|
|
@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):
|
2015-01-31 05:59:09 +03:00
|
|
|
return pgcli.pgexecute.PGExecute(database='_test_db', user=POSTGRES_USER,
|
2015-08-08 02:32:39 +03:00
|
|
|
host=POSTGRES_HOST, password=None, port=None, dsn=None)
|