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

Function test_commit

tests/test_connection.py:338–351  ·  view source on GitHub ↗
(conn)

Source from the content-addressed store, hash-verified

336
337
338def test_commit(conn):
339 conn.pgconn.exec_(b"drop table if exists foo")
340 conn.pgconn.exec_(b"create table foo (id int primary key)")
341 conn.pgconn.exec_(b"begin")
342 assert conn.pgconn.transaction_status == pq.TransactionStatus.INTRANS
343 conn.pgconn.exec_(b"insert into foo values (1)")
344 conn.commit()
345 assert conn.pgconn.transaction_status == pq.TransactionStatus.IDLE
346 res = conn.pgconn.exec_(b"select id from foo where id = 1")
347 assert res.get_value(0, 0) == b"1"
348
349 conn.close()
350 with pytest.raises(psycopg.OperationalError):
351 conn.commit()
352
353
354@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…