MCPcopy
hub / github.com/psycopg/psycopg / test_trace_pre14

Function test_trace_pre14

tests/pq/test_pgconn.py:630–641  ·  view source on GitHub ↗
(pgconn, tmp_path)

Source from the content-addressed store, hash-verified

628@pytest.mark.libpq("< 14")
629@pytest.mark.skipif("sys.platform != 'linux'")
630def test_trace_pre14(pgconn, tmp_path):
631 tracef = tmp_path / "trace"
632 with tracef.open("w") as f:
633 pgconn.trace(f.fileno())
634 with pytest.raises(psycopg.NotSupportedError):
635 pgconn.set_trace_flags(0)
636 pgconn.exec_(b"select 1")
637 pgconn.untrace()
638 pgconn.exec_(b"select 2")
639 traces = tracef.read_text()
640 assert "select 1" in traces
641 assert "select 2" not in traces
642
643
644@pytest.mark.libpq(">= 14")

Callers

nothing calls this directly

Calls 6

filenoMethod · 0.80
openMethod · 0.45
traceMethod · 0.45
set_trace_flagsMethod · 0.45
exec_Method · 0.45
untraceMethod · 0.45

Tested by

no test coverage detected