mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Avoid creating a task to clear the hass instance at test teardown (#117103)
This commit is contained in:
parent
8c37b3afd7
commit
ead69af27c
@ -353,10 +353,11 @@ async def async_test_home_assistant(
|
||||
|
||||
hass.set_state(CoreState.running)
|
||||
|
||||
async def clear_instance(event):
|
||||
@callback
|
||||
def clear_instance(event):
|
||||
"""Clear global instance."""
|
||||
await asyncio.sleep(0) # Give aiohttp one loop iteration to close
|
||||
INSTANCES.remove(hass)
|
||||
# Give aiohttp one loop iteration to close
|
||||
hass.loop.call_soon(INSTANCES.remove, hass)
|
||||
|
||||
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_CLOSE, clear_instance)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user