Esempio n. 1
0
async def test_wait_async_bad(pgconn):
    pgconn.send_query(b"select 1")
    gen = generators.execute(pgconn)
    socket = pgconn.socket
    pgconn.finish()
    with pytest.raises(psycopg.OperationalError):
        await waiting.wait_async(gen, socket)
Esempio n. 2
0
def execute_wait(pgconn):
    return psycopg.waiting.wait(execute(pgconn), pgconn.socket)
Esempio n. 3
0
def test_wait_epoll(pgconn, timeout):
    pgconn.send_query(b"select 1")
    gen = generators.execute(pgconn)
    (res,) = waiting.wait_epoll(gen, pgconn.socket, **timeout)
    assert res.status == ExecStatus.TUPLES_OK
Esempio n. 4
0
def test_wait_selector_bad(pgconn):
    pgconn.send_query(b"select 1")
    gen = generators.execute(pgconn)
    pgconn.finish()
    with pytest.raises(psycopg.OperationalError):
        waiting.wait_selector(gen, pgconn.socket)
Esempio n. 5
0
async def test_wait_async(pgconn):
    pgconn.send_query(b"select 1")
    gen = generators.execute(pgconn)
    (res,) = await waiting.wait_async(gen, pgconn.socket)
    assert res.status == ExecStatus.TUPLES_OK