MCPcopy
hub / github.com/psycopg/psycopg / test_inerror_rollback

Function test_inerror_rollback

tests/pool/test_pool_async.py:300–316  ·  view source on GitHub ↗
(dsn, caplog)

Source from the content-addressed store, hash-verified

298
299@pytest.mark.crdb_skip("backend pid")
300async def test_inerror_rollback(dsn, caplog):
301 caplog.set_level(logging.WARNING, logger="psycopg.pool")
302
303 async with pool.AsyncConnectionPool(dsn, min_size=1) as p:
304 conn = await p.getconn()
305 pid = conn.info.backend_pid
306 with pytest.raises(psycopg.ProgrammingError):
307 await conn.execute("wat")
308 assert conn.info.transaction_status == TransactionStatus.INERROR
309 await p.putconn(conn)
310
311 async with p.connection() as conn2:
312 assert conn2.info.backend_pid == pid
313 assert conn2.info.transaction_status == TransactionStatus.IDLE
314
315 assert len(caplog.records) == 1
316 assert "INERROR" in caplog.records[0].message
317
318
319@pytest.mark.crdb_skip("backend pid")

Callers

nothing calls this directly

Calls 4

getconnMethod · 0.45
executeMethod · 0.45
putconnMethod · 0.45
connectionMethod · 0.45

Tested by

no test coverage detected