Make system_log test reliable (#40049)

This commit is contained in:
J. Nick Koston authored and GitHub committed 2020-09-14 08:48:59 +02:00
1 parent c19b5c5ac3
commit 2e1dbe51a4
2 files changed
+5

No files matched your search

@@ -211,6 +211,8 @@ async def async_setup(hass, config):
handler = LogErrorHandler(hass, conf[CONF_MAX_ENTRIES], conf[CONF_FIRE_EVENT])
hass.data[DOMAIN] = handler
listener = logging.handlers.QueueListener(
simple_queue, handler, respect_handler_level=True
)
@@ -222,6 +224,7 @@ async def async_setup(hass, config):
"""Cleanup handler."""
logging.root.removeHandler(queue_handler)
listener.stop()
del hass.data[DOMAIN]
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_CLOSE, _async_stop_queue_handler)