Skip to content

Commit 752467d

Browse files
authored
test: fix stalling future (microsoft#2282)
1 parent d7b3569 commit 752467d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/async/test_unroute_behavior.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ async def _unroute_promise() -> None:
351351
async def test_page_close_does_not_wait_for_active_route_handlers(
352352
page: Page, server: Server
353353
) -> None:
354+
stalling_future: "asyncio.Future[None]" = asyncio.Future()
354355
second_handler_called = False
355356

356357
def _handler1(route: Route) -> None:
@@ -365,7 +366,7 @@ def _handler1(route: Route) -> None:
365366

366367
async def _handler2(route: Route) -> None:
367368
route_future.set_result(route)
368-
await asyncio.Future()
369+
await stalling_future
369370

370371
await page.route(
371372
"**/*",
@@ -383,6 +384,7 @@ async def _goto_ignore_exceptions() -> None:
383384
await page.close()
384385
await asyncio.sleep(0.5)
385386
assert not second_handler_called
387+
stalling_future.cancel()
386388

387389

388390
async def test_route_continue_should_not_throw_if_page_has_been_closed(

0 commit comments

Comments
 (0)