MCPcopy
hub / github.com/psycopg/psycopg / test_tpc_commit_recovered

Method test_tpc_commit_recovered

tests/test_tpc.py:65–88  ·  view source on GitHub ↗
(self, conn_cls, conn, dsn, tpc)

Source from the content-addressed store, hash-verified

63 assert tpc.count_test_records() == 1
64
65 def test_tpc_commit_recovered(self, conn_cls, conn, dsn, tpc):
66 xid = conn.xid(1, "gtrid", "bqual")
67 assert conn.info.transaction_status == TransactionStatus.IDLE
68
69 conn.tpc_begin(xid)
70 assert conn.info.transaction_status == TransactionStatus.INTRANS
71
72 cur = conn.cursor()
73 cur.execute("insert into test_tpc values ('test_tpc_commit_rec')")
74 assert tpc.count_xacts() == 0
75 assert tpc.count_test_records() == 0
76
77 conn.tpc_prepare()
78 conn.close()
79 assert tpc.count_xacts() == 1
80 assert tpc.count_test_records() == 0
81
82 with conn_cls.connect(dsn) as conn:
83 xid = conn.xid(1, "gtrid", "bqual")
84 conn.tpc_commit(xid)
85 assert conn.info.transaction_status == TransactionStatus.IDLE
86
87 assert tpc.count_xacts() == 0
88 assert tpc.count_test_records() == 1
89
90 def test_tpc_rollback(self, conn, tpc):
91 xid = conn.xid(1, "gtrid", "bqual")

Callers

nothing calls this directly

Calls 10

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
closeMethod · 0.45
connectMethod · 0.45
tpc_commitMethod · 0.45

Tested by

no test coverage detected