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)
def execute_wait(pgconn): return psycopg.waiting.wait(execute(pgconn), pgconn.socket)
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
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)
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