Changes are rolled back if an exception escapes the `with` block.
(aconn)
| 72 | |
| 73 | |
| 74 | async def test_rollback_on_exception_exit(aconn): |
| 75 | """Changes are rolled back if an exception escapes the `with` block.""" |
| 76 | with pytest.raises(ExpectedException): |
| 77 | async with aconn.transaction(): |
| 78 | await insert_row(aconn, "foo") |
| 79 | raise ExpectedException("This discards the insert") |
| 80 | |
| 81 | assert not in_transaction(aconn) |
| 82 | assert not await inserted(aconn) |
| 83 | |
| 84 | |
| 85 | @pytest.mark.crdb_skip("pg_terminate_backend") |
nothing calls this directly
no test coverage detected