diff --git a/tests/components/sonos/test_init.py b/tests/components/sonos/test_init.py index f8ac5fc6dbf..85ab8f4dd5a 100644 --- a/tests/components/sonos/test_init.py +++ b/tests/components/sonos/test_init.py @@ -213,6 +213,8 @@ async def test_async_poll_manual_hosts_1( not in caplog.text ) + await hass.async_block_till_done(wait_background_tasks=True) + async def test_async_poll_manual_hosts_2( hass: HomeAssistant, @@ -237,6 +239,8 @@ async def test_async_poll_manual_hosts_2( in caplog.text ) + await hass.async_block_till_done(wait_background_tasks=True) + async def test_async_poll_manual_hosts_3( hass: HomeAssistant, @@ -261,6 +265,8 @@ async def test_async_poll_manual_hosts_3( in caplog.text ) + await hass.async_block_till_done(wait_background_tasks=True) + async def test_async_poll_manual_hosts_4( hass: HomeAssistant, @@ -285,6 +291,8 @@ async def test_async_poll_manual_hosts_4( not in caplog.text ) + await hass.async_block_till_done(wait_background_tasks=True) + class SpeakerActivity: """Unit test class to track speaker activity messages.""" @@ -348,6 +356,8 @@ async def test_async_poll_manual_hosts_5( assert "Activity on Living Room" in caplog.text assert "Activity on Bedroom" in caplog.text + await hass.async_block_till_done(wait_background_tasks=True) + async def test_async_poll_manual_hosts_6( hass: HomeAssistant, @@ -386,6 +396,8 @@ async def test_async_poll_manual_hosts_6( assert speaker_1_activity.call_count == 0 assert speaker_2_activity.call_count == 0 + await hass.async_block_till_done(wait_background_tasks=True) + async def test_async_poll_manual_hosts_7( hass: HomeAssistant, @@ -413,6 +425,8 @@ async def test_async_poll_manual_hosts_7( assert "media_player.garage" in entity_registry.entities assert "media_player.studio" in entity_registry.entities + await hass.async_block_till_done(wait_background_tasks=True) + async def test_async_poll_manual_hosts_8( hass: HomeAssistant, @@ -439,3 +453,4 @@ async def test_async_poll_manual_hosts_8( assert "media_player.basement" in entity_registry.entities assert "media_player.garage" in entity_registry.entities assert "media_player.studio" in entity_registry.entities + await hass.async_block_till_done(wait_background_tasks=True)