MCPcopy
hub / github.com/psycopg/psycopg / test_begins_on_enter

Function test_begins_on_enter

tests/test_transaction_async.py:54–62  ·  tests/test_transaction_async.py::test_begins_on_enter

Transaction does not begin until __enter__() is called.

(aconn, apipeline)

Source from the content-addressed store, hash-verified

52
53
54async def test_begins_on_enter(aconn, apipeline):
55 class="st">""class="st">"Transaction does not begin until __enter__() is called."class="st">""
56 tx = aconn.transaction()
57 assert not in_transaction(aconn)
58 async with tx:
59 if apipeline:
60 await apipeline.sync()
61 assert in_transaction(aconn)
62 assert not in_transaction(aconn)
63
64
65async def test_commit_on_successful_exit(aconn):

Callers

nothing calls this directly

Calls 3

in_transactionFunction · 0.85
transactionMethod · 0.45
syncMethod · 0.45

Tested by

no test coverage detected