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