Skip to content

Commit

Permalink
Fix aiohttp test server teardown (#3726)
Browse files Browse the repository at this point in the history
  • Loading branch information
DoctorJohn authored Dec 14, 2024
1 parent 7a42b03 commit a0573da
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions tests/http/clients/aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,9 @@ async def ws_connect(
*,
protocols: List[str],
) -> AsyncGenerator[WebSocketClient, None]:
server = TestServer(self.app)
await server.start_server()
client = TestClient(server)
async with client.ws_connect(url, protocols=protocols) as ws:
yield AioWebSocketClient(ws)
async with TestClient(TestServer(self.app)) as client:
async with client.ws_connect(url, protocols=protocols) as ws:
yield AioWebSocketClient(ws)


class AioWebSocketClient(WebSocketClient):
Expand Down

0 comments on commit a0573da

Please sign in to comment.