Skip to content

Commit 4cbc9dc

Browse files
committed
fix test
1 parent 1229fa3 commit 4cbc9dc

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

packages/service-library/tests/fastapi/test_request_decorators.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import asyncio
77
from collections.abc import Awaitable, Callable
8-
from typing import Any
98
from unittest.mock import AsyncMock
109

1110
import pytest
@@ -18,29 +17,24 @@
1817
@pytest.fixture
1918
def long_running_poller_mock(
2019
monkeypatch: pytest.MonkeyPatch,
21-
) -> Callable[[asyncio.Event, Request, Any], Awaitable]:
20+
) -> Callable[[asyncio.Event, Request], Awaitable]:
2221

23-
async def _mock_disconnect_poller(
24-
close_event: asyncio.Event, request: Request, result: Any
25-
):
22+
async def _mock_disconnect_poller(close_event: asyncio.Event, request: Request):
2623
_mock_disconnect_poller.called = True
2724
while not await request.is_disconnected():
28-
await asyncio.sleep(0.01)
25+
await asyncio.sleep(2)
2926
if close_event.is_set():
30-
# Simulate a long cleanup procedure
31-
await asyncio.sleep(POLLER_CLEANUP_DELAY_S)
3227
break
33-
return result
3428

3529
monkeypatch.setattr(
36-
"servicelib.fastapi.requests_decorators._disconnect_poller",
30+
"servicelib.fastapi.requests_decorators._disconnect_poller_for_task_group",
3731
_mock_disconnect_poller,
3832
)
3933
return _mock_disconnect_poller
4034

4135

4236
async def test_decorator_waits_for_poller_cleanup(
43-
long_running_poller_mock: Callable[[asyncio.Event, Request, Any], Awaitable],
37+
long_running_poller_mock: Callable[[asyncio.Event, Request], Awaitable],
4438
):
4539
"""
4640
Tests that the decorator's wrapper waits for the poller task to finish

0 commit comments

Comments
 (0)