def test_wait_conn(dsn, timeout, retries): for retry in retries: with retry: gen = generators.connect(dsn) conn = waiting.wait_conn(gen, **timeout) assert conn.status == ConnStatus.OK
def test_wait_conn_bad(dsn): gen = generators.connect("dbname=nosuchdb") with pytest.raises(psycopg.OperationalError): waiting.wait_conn(gen)
async def test_wait_conn_async(dsn, timeout): gen = generators.connect(dsn) conn = await waiting.wait_conn_async(gen, **timeout) assert conn.status == ConnStatus.OK