Adding upstream version 1.1.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
9c1e264be3
commit
f19547bec9
22 changed files with 4449 additions and 0 deletions
40
tests/conftest.py
Normal file
40
tests/conftest.py
Normal file
|
@ -0,0 +1,40 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from typing import Generator
|
||||
|
||||
import psycopg
|
||||
import pytest
|
||||
from harlequin_postgres.adapter import (
|
||||
HarlequinPostgresAdapter,
|
||||
HarlequinPostgresConnection,
|
||||
)
|
||||
|
||||
if sys.version_info < (3, 10):
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
|
||||
TEST_DB_CONN = "postgresql://postgres:for-testing@localhost:5432"
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def connection() -> Generator[HarlequinPostgresConnection, None, None]:
|
||||
pgconn = psycopg.connect(conninfo=TEST_DB_CONN, dbname="postgres")
|
||||
pgconn.autocommit = True
|
||||
cur = pgconn.cursor()
|
||||
cur.execute("drop database if exists test;")
|
||||
cur.execute("create database test;")
|
||||
cur.close()
|
||||
pgconn.close()
|
||||
conn = HarlequinPostgresAdapter(
|
||||
conn_str=(f"{TEST_DB_CONN}",), dbname="test"
|
||||
).connect()
|
||||
yield conn
|
||||
conn.close()
|
||||
pgconn = psycopg.connect(conninfo=TEST_DB_CONN, dbname="postgres")
|
||||
pgconn.autocommit = True
|
||||
cur = pgconn.cursor()
|
||||
cur.execute("drop database if exists test;")
|
||||
cur.close()
|
||||
pgconn.close()
|
Loading…
Add table
Add a link
Reference in a new issue