Closed epsilon-0 closed 3 weeks ago
Starlette updated their code with the new error type - https://github.com/encode/starlette/commit/93e74a4d2f171bc48c66133d04b071c28ea63562
The test cases are failing due to broken return type.
____________________________ test_request_response _____________________________ @pytest.mark.asyncio async def test_request_response(): @request_response async def view(request: Request) -> Response: return PlainTextResponse(await request.body) async with httpx.AsyncClient(app=view, base_url="http://testServer/") as client: assert (await client.get("/")).text == "" assert (await client.post("/", content="hello")).text == "hello" client = TestClient(view) with pytest.raises(WebSocketDisconnect) as exc: > with client.websocket_connect("/"): tests/test_asgi.py:1230: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/local/lib/python3.11/site-packages/starlette/testclient.py:114: in __enter__ self._raise_on_close(message) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <starlette.testclient.WebSocketTestSession object at 0x1f7c9a9b450> message = {'body': b'', 'more_body': False, 'type': 'websocket.http.response.body'} def _raise_on_close(self, message: Message) -> None: if message["type"] == "websocket.close": raise WebSocketDisconnect( code=message.get("code", 1000), reason=message.get("reason", "") ) elif message["type"] == "websocket.http.response.start": status_code: int = message["status"] headers: list[tuple[bytes, bytes]] = message["headers"] body: list[bytes] = [] while True: message = self.receive() assert message["type"] == "websocket.http.response.body" body.append(message["body"]) if not message.get("more_body", False): break > raise WebSocketDenialResponse( status_code=status_code, headers=headers, content=b"".join(body), ) E starlette.testclient.WebSocketDenialResponse /usr/local/lib/python3.11/site-packages/starlette/testclient.py:185: WebSocketDenialResponse
please use pdm sync to install dependencies
pdm sync
Starlette updated their code with the new error type - https://github.com/encode/starlette/commit/93e74a4d2f171bc48c66133d04b071c28ea63562
The test cases are failing due to broken return type.