diff --git a/game/server/eventstream/routes.py b/game/server/eventstream/routes.py index 929a0b1b..d55b005b 100644 --- a/game/server/eventstream/routes.py +++ b/game/server/eventstream/routes.py @@ -1,5 +1,5 @@ import asyncio -from asyncio import wait +from asyncio import wait, Future from fastapi import APIRouter, WebSocket from fastapi.encoders import jsonable_encoder @@ -16,9 +16,9 @@ class ConnectionManager: self.active_connections: list[WebSocket] = [] async def shutdown(self) -> None: - futures = [] + futures: list[Future[None]] = [] for connection in self.active_connections: - futures.append(connection.close()) + futures.append(asyncio.create_task(connection.close())) await wait(futures) async def connect(self, websocket: WebSocket) -> None: diff --git a/requirements.txt b/requirements.txt index 0f85a4c1..327e1896 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,7 +22,7 @@ idna==3.6 iniconfig==2.0.0 Jinja2==3.1.2 MarkupSafe==2.1.3 -mypy==1.2.0 +mypy==1.7.1 mypy-extensions==1.0.0 nodeenv==1.8.0 numpy==1.26.2 diff --git a/tests/test_pilot.py b/tests/test_pilot.py index c61346bb..70b260f1 100644 --- a/tests/test_pilot.py +++ b/tests/test_pilot.py @@ -1,6 +1,6 @@ import pytest - from faker import Faker + from game.squadrons.pilot import Pilot, PilotStatus @@ -29,7 +29,8 @@ def test_pilot_on_leave(pilot: Pilot) -> None: assert pilot.on_leave == True pilot.return_from_leave() assert pilot.status == PilotStatus.Active - assert pilot.on_leave == False + # mypy thinks this line is unreachable. It isn't. + assert pilot.on_leave == False # type: ignore def test_pilot_on_leave_twice(pilot: Pilot) -> None: