(aconn, caplog)
| 180 | |
| 181 | @pytest.mark.skipif("psycopg._cmodule._psycopg", reason="Python-only debug conn") |
| 182 | async 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 | |
| 202 | def test_prepared_max_none(conn): |
nothing calls this directly
no test coverage detected