MCPcopy
hub / github.com/psycopg/psycopg / pgconn

Function pgconn

tests/fix_db.py:186–195  ·  view source on GitHub ↗

Return a PGconn connection open to `--test-dsn`.

(dsn, request, tracefile)

Source from the content-addressed store, hash-verified

184
185@pytest.fixture
186def pgconn(dsn, request, tracefile):
187 """Return a PGconn connection open to `--test-dsn`."""
188 check_connection_version(request.node)
189 if (conn := pq.PGconn.connect(dsn.encode())).status != pq.ConnStatus.OK:
190 pytest.fail(f"bad connection: {conn.get_error_message()}")
191
192 with maybe_trace(conn, tracefile, request.function):
193 yield conn
194
195 conn.finish()
196
197
198@pytest.fixture

Callers 1

notice_receiverFunction · 0.85

Calls 6

check_connection_versionFunction · 0.85
maybe_traceFunction · 0.85
connectMethod · 0.45
failMethod · 0.45
get_error_messageMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected