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