(conn_cls, proxy, caplog)
| 898 | @pytest.mark.slow |
| 899 | @pytest.mark.timing |
| 900 | def test_cancel_safe_error(conn_cls, proxy, caplog): |
| 901 | caplog.set_level(logging.WARNING, logger="psycopg") |
| 902 | proxy.start() |
| 903 | with conn_cls.connect(proxy.client_dsn) as conn: |
| 904 | proxy.stop() |
| 905 | with pytest.raises( |
| 906 | e.OperationalError, match="(Connection refused)|(connect\\(\\) failed)" |
| 907 | ) as ex: |
| 908 | conn.cancel_safe(timeout=2) |
| 909 | assert not caplog.records |
| 910 | |
| 911 | # Note: testing an internal method. It's ok if this behaviour changes |
| 912 | conn._try_cancel(timeout=2.0) |
| 913 | assert len(caplog.records) == 1 |
| 914 | caplog.records[0].message == str(ex.value) |
| 915 | |
| 916 | |
| 917 | @pytest.mark.slow |
nothing calls this directly
no test coverage detected