MCPcopy
hub / github.com/psycopg/psycopg / test_xid_roundtrip

Method test_xid_roundtrip

tests/test_tpc.py:210–224  ·  view source on GitHub ↗
(self, conn_cls, conn, dsn, tpc, fid, gtrid, bqual)

Source from the content-addressed store, hash-verified

208 [(0, "", ""), (42, "gtrid", "bqual"), (2147483647, "x" * 64, "y" * 64)],
209 )
210 def test_xid_roundtrip(self, conn_cls, conn, dsn, tpc, fid, gtrid, bqual):
211 xid = conn.xid(fid, gtrid, bqual)
212 conn.tpc_begin(xid)
213 conn.tpc_prepare()
214 conn.close()
215
216 with conn_cls.connect(dsn) as conn:
217 xids = [x for x in conn.tpc_recover() if x.database == conn.info.dbname]
218 assert len(xids) == 1
219 xid = xids[0]
220 conn.tpc_rollback(xid)
221
222 assert xid.format_id == fid
223 assert xid.gtrid == gtrid
224 assert xid.bqual == bqual
225
226 # 199 is PostgreSQL's limit in transaction id length
227

Callers

nothing calls this directly

Calls 7

xidMethod · 0.80
tpc_beginMethod · 0.45
tpc_prepareMethod · 0.45
closeMethod · 0.45
connectMethod · 0.45
tpc_recoverMethod · 0.45
tpc_rollbackMethod · 0.45

Tested by

no test coverage detected