MCPcopy
hub / github.com/psycopg/psycopg / test_deallocate_or_close

Function test_deallocate_or_close

tests/test_prepared_async.py:182–199  ·  view source on GitHub ↗
(aconn, caplog)

Source from the content-addressed store, hash-verified

180
181@pytest.mark.skipif("psycopg._cmodule._psycopg", reason="Python-only debug conn")
182async def test_deallocate_or_close(aconn, caplog):
183 aconn.pgconn = PGconnDebug(aconn.pgconn)
184 caplog.set_level(logging.INFO, logger="psycopg.debug")
185
186 await aconn.set_autocommit(True)
187 aconn.prepare_threshold = 0
188 aconn.prepared_max = 1
189
190 await aconn.execute("select 1::bigint")
191 await aconn.execute("select 1::text")
192
193 msgs = "\n".join(rec.message for rec in caplog.records)
194 if psycopg.pq.__build_version__ >= 170000:
195 assert "PGconn.send_close_prepared" in msgs
196 assert "DEALLOCATE" not in msgs
197 else:
198 assert "PGconn.send_close_prepared" not in msgs
199 assert "DEALLOCATE" in msgs
200
201
202def test_prepared_max_none(conn):

Callers

nothing calls this directly

Calls 4

PGconnDebugClass · 0.90
set_autocommitMethod · 0.45
executeMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected