starlette
starlette copied to clipboard
Background Thread created by WebSocketTestSession should exit when close() is called
Hello!
I've been trying to write tests for a starlette websocket API.
Only one problem - the server isn't written in a way to exit nicely when a websocket is closed.
As a result, the tests just sit there, because websocket_connect() won't exit until the server does.
By looking at the source, I figured that WebSocketTestSession is waiting for the session thread (_run()) to complete.
Can we please make it so that it stops the server when close() is called?
I've cobbled together a small commit to make this work. If you're on board with this change, I'd love to upstream this.