Example #1
0
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
Example #2
0
def test_wait_conn_bad(dsn):
    gen = generators.connect("dbname=nosuchdb")
    with pytest.raises(psycopg.OperationalError):
        waiting.wait_conn(gen)
Example #3
0
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