MCPcopy
hub / github.com/psycopg/psycopg / test_context_inerror_rollback_no_clobber

Function test_context_inerror_rollback_no_clobber

tests/test_connection.py:293–307  ·  view source on GitHub ↗
(conn_cls, conn, dsn, caplog)

Source from the content-addressed store, hash-verified

291
292@pytest.mark.crdb_skip("pg_terminate_backend")
293def test_context_inerror_rollback_no_clobber(conn_cls, conn, dsn, caplog):
294 caplog.set_level(logging.WARNING, logger="psycopg")
295
296 with pytest.raises(ZeroDivisionError):
297 with conn_cls.connect(dsn) as conn2:
298 conn2.execute("select 1")
299 conn.execute(
300 "select pg_terminate_backend(%s::int)", [conn2.pgconn.backend_pid]
301 )
302 1 / 0
303
304 assert len(caplog.records) == 1
305 rec = caplog.records[0]
306 assert rec.levelno == logging.WARNING
307 assert "in rollback" in rec.message
308
309
310@pytest.mark.crdb_skip("copy")

Callers

nothing calls this directly

Calls 2

connectMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected