Fix flaky emulated_roku/test_binding.py::test_events_fired_properly test (#148069)

This commit is contained in:
Franck Nijhof 2025-07-04 16:42:24 +02:00 committed by GitHub
parent 5d258c2f82
commit 6235adc69a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,7 +15,7 @@ from homeassistant.components.emulated_roku.binding import (
ROKU_COMMAND_LAUNCH, ROKU_COMMAND_LAUNCH,
EmulatedRoku, EmulatedRoku,
) )
from homeassistant.core import Event, HomeAssistant from homeassistant.core import Event, HomeAssistant, callback
async def test_events_fired_properly(hass: HomeAssistant) -> None: async def test_events_fired_properly(hass: HomeAssistant) -> None:
@ -43,6 +43,7 @@ async def test_events_fired_properly(hass: HomeAssistant) -> None:
return Mock(start=AsyncMock(), close=AsyncMock()) return Mock(start=AsyncMock(), close=AsyncMock())
@callback
def listener(event: Event) -> None: def listener(event: Event) -> None:
if event.data[ATTR_SOURCE_NAME] == random_name: if event.data[ATTR_SOURCE_NAME] == random_name:
events.append(event) events.append(event)