Return a PGconn connection open to `--test-dsn`.
(dsn, request, tracefile)
| 184 | |
| 185 | @pytest.fixture |
| 186 | def 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 |
no test coverage detected