mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 17:27:10 +00:00
Fix contextmanager-generator-missing-cleanup warning in tests (#119478)
This commit is contained in:
parent
f7326d3baf
commit
e3e80c83b7
@ -195,7 +195,9 @@ def get_test_home_assistant() -> Generator[HomeAssistant]:
|
|||||||
|
|
||||||
threading.Thread(name="LoopThread", target=run_loop, daemon=False).start()
|
threading.Thread(name="LoopThread", target=run_loop, daemon=False).start()
|
||||||
|
|
||||||
|
try:
|
||||||
yield hass
|
yield hass
|
||||||
|
finally:
|
||||||
loop.run_until_complete(context_manager.__aexit__(None, None, None))
|
loop.run_until_complete(context_manager.__aexit__(None, None, None))
|
||||||
loop.close()
|
loop.close()
|
||||||
|
|
||||||
@ -359,8 +361,9 @@ async def async_test_home_assistant(
|
|||||||
|
|
||||||
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_CLOSE, clear_instance)
|
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_CLOSE, clear_instance)
|
||||||
|
|
||||||
|
try:
|
||||||
yield hass
|
yield hass
|
||||||
|
finally:
|
||||||
# Restore timezone, it is set when creating the hass object
|
# Restore timezone, it is set when creating the hass object
|
||||||
dt_util.set_default_time_zone(orig_tz)
|
dt_util.set_default_time_zone(orig_tz)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user