Timeout support in WebSocketTestSession #2195
-
Hi! I'm trying to test a WebSocket endpoint with One thing I've noticed is that starlette/starlette/testclient.py Lines 145 to 146 in 2168e47 starlette/starlette/testclient.py Lines 165 to 166 in 2168e47 This, unfortunately, makes the unit tests hang infinitely if the app under test does not behave properly. Would adding and passing the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
I'd really like a timeout option when testing websockets, so i created #2329 as potential fix. |
Beta Was this translation helpful? Give feedback.
-
I'd recommend you use pure-ASGI when you want to test timeouts. Or connect over a socket and use a real |
Beta Was this translation helpful? Give feedback.
I'd recommend you use pure-ASGI when you want to test timeouts. Or connect over a socket and use a real
httpx
instance, it will help make sure your catching the right errors.