MCPcopy
hub / github.com/psycopg/psycopg / test_context_commit

Function test_context_commit

tests/test_connection.py:255–266  ·  tests/test_connection.py::test_context_commit
(conn_cls, conn, dsn)

Source from the content-addressed store, hash-verified

253
254@pytest.mark.usefixtures(class="st">"testctx")
255def test_context_commit(conn_cls, conn, dsn):
256 with conn:
257 with conn.cursor() as cur:
258 cur.execute(class="st">"insert into testctx values (42)")
259
260 assert conn.closed
261 assert not conn.broken
262
263 with conn_cls.connect(dsn) as conn:
264 with conn.cursor() as cur:
265 cur.execute(class="st">"select * from testctx")
266 assert cur.fetchall() == [(42,)]
267
268
269@pytest.mark.usefixtures(class="st">"testctx")

Callers

nothing calls this directly

Calls 4

cursorMethod · 0.45
executeMethod · 0.45
connectMethod · 0.45
fetchallMethod · 0.45

Tested by

no test coverage detected