MCPcopy
hub / github.com/psycopg/psycopg / test_commit

Function test_commit

tests/test_connection_async.py:334–347  ·  view source on GitHub ↗
(aconn)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

exec_Method · 0.45
commitMethod · 0.45
get_valueMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…