The error can be triggered easily by the user. The condition is handled
just naturally by all the methods calling _fetch_pipeline().
):
with self._conn.lock:
self._conn.wait(self._conn._pipeline._fetch_gen(flush=True))
- assert self.pgresult
):
async with self._conn.lock:
await self._conn.wait(self._conn._pipeline._fetch_gen(flush=True))
- assert self.pgresult
conn.commit()
+def test_fetch_no_result(conn):
+ with conn.pipeline():
+ cur = conn.cursor()
+ with pytest.raises(e.ProgrammingError):
+ cur.fetchone()
+
+
def test_executemany(conn):
conn.autocommit = True
conn.execute("drop table if exists execmanypipeline")
await aconn.commit()
+async def test_fetch_no_result(aconn):
+ async with aconn.pipeline():
+ cur = aconn.cursor()
+ with pytest.raises(e.ProgrammingError):
+ await cur.fetchone()
+
+
async def test_executemany(aconn):
await aconn.set_autocommit(True)
await aconn.execute("drop table if exists execmanypipeline")