diff --git a/requirements.txt b/requirements.txt index a99dc024ae..305bd0186c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,7 +7,7 @@ h11 @ git+https://github.com/python-hyper/h11.git@master # Explicit optionals a2wsgi==1.7.0 wsproto==1.2.0 -websockets==10.4 +websockets==11.0.3 # Packaging build==0.10.0 diff --git a/tests/protocols/test_websocket.py b/tests/protocols/test_websocket.py index 1dd82bbcb4..9210279fe2 100644 --- a/tests/protocols/test_websocket.py +++ b/tests/protocols/test_websocket.py @@ -577,7 +577,7 @@ async def test_asgi_return_value( unused_tcp_port: int, ): """ - The ASGI callable should return 'None'. If it doesn't make sure that + The ASGI callable should return 'None'. If it doesn't, make sure that the connection is closed with an error condition. """ @@ -597,9 +597,8 @@ async def connect(url): port=unused_tcp_port, ) async with run_server(config): - with pytest.raises(websockets.exceptions.ConnectionClosed) as exc_info: + with pytest.raises(websockets.exceptions.WebSocketException): await connect(f"ws://127.0.0.1:{unused_tcp_port}") - assert exc_info.value.code == 1006 @pytest.mark.anyio diff --git a/uvicorn/protocols/websockets/websockets_impl.py b/uvicorn/protocols/websockets/websockets_impl.py index 04d41bad9c..d7d18e3a82 100644 --- a/uvicorn/protocols/websockets/websockets_impl.py +++ b/uvicorn/protocols/websockets/websockets_impl.py @@ -264,7 +264,6 @@ async def run_asgi(self) -> None: elif result is not None: msg = "ASGI callable should return None, but returned '%s'." self.logger.error(msg, result) - await self.handshake_completed_event.wait() self.transport.close() async def asgi_send(self, message: "ASGISendEvent") -> None: