| 973 | @pytest.mark.slow |
| 974 | @pytest.mark.crdb("skip", reason="error result not returned") |
| 975 | async def test_right_exception_on_session_timeout(aconn): |
| 976 | want_ex: type[psycopg.Error] = e.IdleInTransactionSessionTimeout |
| 977 | if sys.platform == "win32": |
| 978 | # No idea why this is needed and `test_right_exception_on_server_disconnect` |
| 979 | # works instead. Maybe the difference lies in the server we are testing |
| 980 | # with, not in the client. |
| 981 | want_ex = psycopg.OperationalError |
| 982 | |
| 983 | await aconn.execute("SET SESSION idle_in_transaction_session_timeout = 100") |
| 984 | await asleep(1) |
| 985 | with pytest.raises(want_ex) as ex: |
| 986 | await aconn.execute("SELECT * from pg_tables") |
| 987 | |
| 988 | # This check is here to monitor if the behaviour on Window chamge. |
| 989 | # Rreceiving the same exception of other platform will be acceptable. |
| 990 | assert type(ex.value) is want_ex |
| 991 | |
| 992 | |
| 993 | @pytest.mark.libpq(">= 14") |