mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Fix imap test RuntimeWarning (#98865)
This commit is contained in:
parent
6be47b1fbd
commit
5ae366957f
@ -470,6 +470,8 @@ async def test_reset_last_message(
|
||||
) -> None:
|
||||
"""Test receiving a message successfully."""
|
||||
event = asyncio.Event() # needed for pushed coordinator to make a new loop
|
||||
idle_start_future = asyncio.Future()
|
||||
idle_start_future.set_result(None)
|
||||
|
||||
async def _sleep_till_event() -> None:
|
||||
"""Simulate imap server waiting for pushes message and keep the push loop going.
|
||||
@ -479,10 +481,10 @@ async def test_reset_last_message(
|
||||
nonlocal event
|
||||
await event.wait()
|
||||
event.clear()
|
||||
mock_imap_protocol.idle_start.return_value = AsyncMock()()
|
||||
mock_imap_protocol.idle_start = AsyncMock(return_value=idle_start_future)
|
||||
|
||||
# Make sure we make another cycle (needed for pushed coordinator)
|
||||
mock_imap_protocol.idle_start.return_value = AsyncMock()()
|
||||
mock_imap_protocol.idle_start = AsyncMock(return_value=idle_start_future)
|
||||
# Mock we wait till we push an update (needed for pushed coordinator)
|
||||
mock_imap_protocol.wait_server_push.side_effect = _sleep_till_event
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user