Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamsorcerer committed Dec 7, 2023
1 parent eefa7ff commit f315c58
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/test_runserver_watch.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncio
import time
from functools import partial
from typing import Set, Tuple
from typing import Any, Set, Tuple
from unittest.mock import AsyncMock, MagicMock, call

from aiohttp import ClientSession
Expand Down Expand Up @@ -206,11 +206,12 @@ async def test_restart_after_connection_loss(mocker):

app = mocker.create_autospec(Application, spec_set=True, instance=True)
# Simulate connection lost from recent restart.
d = {WS: set(), LAST_RELOAD: [1, time.time()]}
ws: Set[Any] = set()
d = {WS: ws, LAST_RELOAD: [1, time.time()]}
app.__getitem__.side_effect = lambda k: d.get(k, MagicMock())

def update_ws(i):
d[WS].add(MagicMock(spec_set=()))
ws.add(MagicMock(spec_set=()))
return AsyncMock()

sleep_mock = mocker.patch("asyncio.sleep", autospec=True, spec_set=True)
Expand Down

0 comments on commit f315c58

Please sign in to comment.