(pool_cls, conn_cls, dsn, autocommit)
| 595 | @pytest.mark.crdb_skip("pg_terminate_backend") |
| 596 | @pytest.mark.parametrize("autocommit", [True, False]) |
| 597 | def test_check_connection(pool_cls, conn_cls, dsn, autocommit): |
| 598 | conn = conn_cls.connect(dsn) |
| 599 | set_autocommit(conn, autocommit) |
| 600 | pool_cls.check_connection(conn) |
| 601 | assert not conn.closed |
| 602 | assert conn.info.transaction_status == psycopg.pq.TransactionStatus.IDLE |
| 603 | |
| 604 | with conn_cls.connect(dsn) as conn2: |
| 605 | conn2.execute("select pg_terminate_backend(%s)", [conn.info.backend_pid]) |
| 606 | |
| 607 | with pytest.raises(psycopg.OperationalError): |
| 608 | pool_cls.check_connection(conn) |
| 609 | |
| 610 | assert conn.closed |
| 611 | |
| 612 | |
| 613 | def test_check_init(pool_cls, dsn): |
nothing calls this directly
no test coverage detected