RFC - Add a 3rd state to the HA shutdown sequence for writing… (#33358)
* add third stage to hass shutdown * use 3rd stage in storage * update core state * add writing data to multi stop ignore * update core test * review comment * update name based on feedback
This commit is contained in:
1 parent
01bf4daf37
commit
bcd1eb952c
6 files changed
+27
-8
No files matched your search
+7
-1
@@ -21,6 +21,7 @@ from homeassistant.const import (
|
||||
EVENT_CALL_SERVICE,
|
||||
EVENT_CORE_CONFIG_UPDATE,
|
||||
EVENT_HOMEASSISTANT_CLOSE,
|
||||
EVENT_HOMEASSISTANT_FINAL_WRITE,
|
||||
EVENT_HOMEASSISTANT_STOP,
|
||||
EVENT_SERVICE_REGISTERED,
|
||||
EVENT_SERVICE_REMOVED,
|
||||
@@ -151,10 +152,14 @@ def test_stage_shutdown():
|
||||
"""Simulate a shutdown, test calling stuff."""
|
||||
hass = get_test_home_assistant()
|
||||
test_stop = []
|
||||
test_final_write = []
|
||||
test_close = []
|
||||
test_all = []
|
||||
|
||||
hass.bus.listen(EVENT_HOMEASSISTANT_STOP, lambda event: test_stop.append(event))
|
||||
hass.bus.listen(
|
||||
EVENT_HOMEASSISTANT_FINAL_WRITE, lambda event: test_final_write.append(event)
|
||||
)
|
||||
hass.bus.listen(EVENT_HOMEASSISTANT_CLOSE, lambda event: test_close.append(event))
|
||||
hass.bus.listen("*", lambda event: test_all.append(event))
|
||||
|
||||
@@ -162,7 +167,8 @@ def test_stage_shutdown():
|
||||
|
||||
assert len(test_stop) == 1
|
||||
assert len(test_close) == 1
|
||||
assert len(test_all) == 1
|
||||
assert len(test_final_write) == 1
|
||||
assert len(test_all) == 2
|
||||
|
||||
|
||||
class TestHomeAssistant(unittest.TestCase):
|
||||
|
||||
Reference in new issue
Block a user