From 1cceaaf19340bbb4a6e67edda9ae7cba6163fe69 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 12 Mar 2024 12:01:39 -1000 Subject: [PATCH] Small improvement to test run time (#113175) --- tests/common.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/common.py b/tests/common.py index cbc295bf43a..6d0e74021e3 100644 --- a/tests/common.py +++ b/tests/common.py @@ -295,7 +295,9 @@ async def async_test_home_assistant( }, ) hass.bus.async_listen_once( - EVENT_HOMEASSISTANT_STOP, hass.config_entries._async_shutdown + EVENT_HOMEASSISTANT_STOP, + hass.config_entries._async_shutdown, + run_immediately=True, ) # Load the registries @@ -878,7 +880,9 @@ class MockEntityPlatform(entity_platform.EntityPlatform): def _async_on_stop(_: Event) -> None: self.async_shutdown() - hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _async_on_stop) + hass.bus.async_listen_once( + EVENT_HOMEASSISTANT_STOP, _async_on_stop, run_immediately=True + ) class MockToggleEntity(entity.ToggleEntity):