Sonos remove unneeded mocking from test (#147064)

This commit is contained in:
Pete Sage 2025-07-04 17:02:38 -04:00 committed by GitHub
parent 79683c8267
commit be7735964b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,7 +1,6 @@
"""Tests for the Sonos config flow.""" """Tests for the Sonos config flow."""
import asyncio import asyncio
from datetime import timedelta
import logging import logging
from unittest.mock import Mock, PropertyMock, patch from unittest.mock import Mock, PropertyMock, patch
@ -330,11 +329,6 @@ async def test_async_poll_manual_hosts_5(
soco_2.renderingControl = Mock() soco_2.renderingControl = Mock()
soco_2.renderingControl.GetVolume = Mock() soco_2.renderingControl.GetVolume = Mock()
speaker_2_activity = SpeakerActivity(hass, soco_2) speaker_2_activity = SpeakerActivity(hass, soco_2)
with patch(
"homeassistant.components.sonos.DISCOVERY_INTERVAL"
) as mock_discovery_interval:
# Speed up manual discovery interval so second iteration runs sooner
mock_discovery_interval.total_seconds = Mock(side_effect=[0.5, 60])
with caplog.at_level(logging.DEBUG): with caplog.at_level(logging.DEBUG):
caplog.clear() caplog.clear()
@ -344,7 +338,7 @@ async def test_async_poll_manual_hosts_5(
assert "media_player.bedroom" in entity_registry.entities assert "media_player.bedroom" in entity_registry.entities
assert "media_player.living_room" in entity_registry.entities assert "media_player.living_room" in entity_registry.entities
async_fire_time_changed(hass, dt_util.utcnow() + timedelta(seconds=0.5)) async_fire_time_changed(hass, dt_util.utcnow() + DISCOVERY_INTERVAL)
await hass.async_block_till_done() await hass.async_block_till_done()
await asyncio.gather( await asyncio.gather(
*[speaker_1_activity.event.wait(), speaker_2_activity.event.wait()] *[speaker_1_activity.event.wait(), speaker_2_activity.event.wait()]