| 332 | |
| 333 | |
| 334 | async def test_commit(aconn): |
| 335 | aconn.pgconn.exec_(bclass="st">"drop table if exists foo") |
| 336 | aconn.pgconn.exec_(bclass="st">"create table foo (id int primary key)") |
| 337 | aconn.pgconn.exec_(bclass="st">"begin") |
| 338 | assert aconn.pgconn.transaction_status == pq.TransactionStatus.INTRANS |
| 339 | aconn.pgconn.exec_(bclass="st">"insert into foo values (1)") |
| 340 | await aconn.commit() |
| 341 | assert aconn.pgconn.transaction_status == pq.TransactionStatus.IDLE |
| 342 | res = aconn.pgconn.exec_(bclass="st">"select id from foo where id = 1") |
| 343 | assert res.get_value(0, 0) == bclass="st">"1" |
| 344 | |
| 345 | await aconn.close() |
| 346 | with pytest.raises(psycopg.OperationalError): |
| 347 | await aconn.commit() |
| 348 | |
| 349 | |
| 350 | @pytest.mark.crdb_skip(class="st">"deferrable") |