From ce9d4c868337fefb7abe8acc44f0d44794452958 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 1 Apr 2024 15:34:54 -1000 Subject: [PATCH] Fix flakey cast discovery stop test (#114605) https://github.com/home-assistant/core/actions/runs/8515215623/job/23322322954?pr=114602 --- tests/components/cast/test_media_player.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/components/cast/test_media_player.py b/tests/components/cast/test_media_player.py index d75aebe4ded..72eea4c5ff4 100644 --- a/tests/components/cast/test_media_player.py +++ b/tests/components/cast/test_media_player.py @@ -453,13 +453,13 @@ async def test_stop_discovery_called_on_stop( """Test pychromecast.stop_discovery called on shutdown.""" # start_discovery should be called with empty config await async_setup_cast(hass, {}) - await hass.async_block_till_done() + await hass.async_block_till_done(wait_background_tasks=True) assert castbrowser_mock.return_value.start_discovery.call_count == 1 # stop discovery should be called on shutdown hass.bus.async_fire(EVENT_HOMEASSISTANT_STOP) - await hass.async_block_till_done() - await hass.async_block_till_done() + await hass.async_block_till_done(wait_background_tasks=True) + await hass.async_block_till_done(wait_background_tasks=True) assert castbrowser_mock.return_value.stop_discovery.call_count == 1