MCPcopy
hub / github.com/psycopg/psycopg / test_tpc_rollback

Method test_tpc_rollback

tests/test_tpc_async.py:86–106  ·  view source on GitHub ↗
(self, aconn, tpc)

Source from the content-addressed store, hash-verified

84 assert tpc.count_test_records() == 1
85
86 async def test_tpc_rollback(self, aconn, tpc):
87 xid = aconn.xid(1, "gtrid", "bqual")
88 assert aconn.info.transaction_status == TransactionStatus.IDLE
89
90 await aconn.tpc_begin(xid)
91 assert aconn.info.transaction_status == TransactionStatus.INTRANS
92
93 cur = aconn.cursor()
94 await cur.execute("insert into test_tpc values ('test_tpc_rollback')")
95 assert tpc.count_xacts() == 0
96 assert tpc.count_test_records() == 0
97
98 await aconn.tpc_prepare()
99 assert aconn.info.transaction_status == TransactionStatus.IDLE
100 assert tpc.count_xacts() == 1
101 assert tpc.count_test_records() == 0
102
103 await aconn.tpc_rollback()
104 assert aconn.info.transaction_status == TransactionStatus.IDLE
105 assert tpc.count_xacts() == 0
106 assert tpc.count_test_records() == 0
107
108 async def test_tpc_rollback_one_phase(self, aconn, tpc):
109 xid = aconn.xid(1, "gtrid", "bqual")

Callers

nothing calls this directly

Calls 8

xidMethod · 0.80
count_xactsMethod · 0.80
count_test_recordsMethod · 0.80
tpc_beginMethod · 0.45
cursorMethod · 0.45
executeMethod · 0.45
tpc_prepareMethod · 0.45
tpc_rollbackMethod · 0.45

Tested by

no test coverage detected