mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Fix changed_variables in automation and script traces (#108788)
This commit is contained in:
parent
aa86d87a31
commit
909e58066d
@ -477,11 +477,12 @@ class _ScriptRun:
|
|||||||
try:
|
try:
|
||||||
handler = f"_async_{action}_step"
|
handler = f"_async_{action}_step"
|
||||||
await getattr(self, handler)()
|
await getattr(self, handler)()
|
||||||
trace_element.update_variables(self._variables)
|
|
||||||
except Exception as ex: # pylint: disable=broad-except
|
except Exception as ex: # pylint: disable=broad-except
|
||||||
self._handle_exception(
|
self._handle_exception(
|
||||||
ex, continue_on_error, self._log_exceptions or log_exceptions
|
ex, continue_on_error, self._log_exceptions or log_exceptions
|
||||||
)
|
)
|
||||||
|
finally:
|
||||||
|
trace_element.update_variables(self._variables)
|
||||||
|
|
||||||
def _finish(self) -> None:
|
def _finish(self) -> None:
|
||||||
self._script._runs.remove(self) # pylint: disable=protected-access
|
self._script._runs.remove(self) # pylint: disable=protected-access
|
||||||
|
@ -1337,14 +1337,13 @@ async def test_wait_continue_on_timeout(
|
|||||||
result_wait = {"wait": {"trigger": None, "remaining": 0.0}}
|
result_wait = {"wait": {"trigger": None, "remaining": 0.0}}
|
||||||
variable_wait = dict(result_wait)
|
variable_wait = dict(result_wait)
|
||||||
expected_trace = {
|
expected_trace = {
|
||||||
"0": [{"result": result_wait}],
|
"0": [{"result": result_wait, "variables": variable_wait}],
|
||||||
}
|
}
|
||||||
if continue_on_timeout is False:
|
if continue_on_timeout is False:
|
||||||
expected_trace["0"][0]["result"]["timeout"] = True
|
expected_trace["0"][0]["result"]["timeout"] = True
|
||||||
expected_trace["0"][0]["error"] = ""
|
expected_trace["0"][0]["error"] = ""
|
||||||
expected_script_execution = "aborted"
|
expected_script_execution = "aborted"
|
||||||
else:
|
else:
|
||||||
expected_trace["0"][0]["variables"] = variable_wait
|
|
||||||
expected_trace["1"] = [{"result": {"event": "test_event", "event_data": {}}}]
|
expected_trace["1"] = [{"result": {"event": "test_event", "event_data": {}}}]
|
||||||
expected_script_execution = "finished"
|
expected_script_execution = "finished"
|
||||||
assert_action_trace(expected_trace, expected_script_execution)
|
assert_action_trace(expected_trace, expected_script_execution)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user