(dsn, caplog)
| 275 | |
| 276 | @pytest.mark.crdb_skip("backend pid") |
| 277 | async def test_intrans_rollback(dsn, caplog): |
| 278 | caplog.set_level(logging.WARNING, logger="psycopg.pool") |
| 279 | |
| 280 | async with pool.AsyncConnectionPool(dsn, min_size=1) as p: |
| 281 | conn = await p.getconn() |
| 282 | pid = conn.info.backend_pid |
| 283 | await conn.execute("create table test_intrans_rollback ()") |
| 284 | assert conn.info.transaction_status == TransactionStatus.INTRANS |
| 285 | await p.putconn(conn) |
| 286 | |
| 287 | async with p.connection() as conn2: |
| 288 | assert conn2.info.backend_pid == pid |
| 289 | assert conn2.info.transaction_status == TransactionStatus.IDLE |
| 290 | cur = await conn2.execute( |
| 291 | "select 1 from pg_class where relname = 'test_intrans_rollback'" |
| 292 | ) |
| 293 | assert not await cur.fetchone() |
| 294 | |
| 295 | assert len(caplog.records) == 1 |
| 296 | assert "INTRANS" in caplog.records[0].message |
| 297 | |
| 298 | |
| 299 | @pytest.mark.crdb_skip("backend pid") |
nothing calls this directly
no test coverage detected