Fix changed_variables in automation and script traces (#108788)
This commit is contained in:
parent
aa86d87a31
commit
909e58066d
2 changed files with 3 additions and 3 deletions
|
@ -477,11 +477,12 @@ class _ScriptRun:
|
|||
try:
|
||||
handler = f"_async_{action}_step"
|
||||
await getattr(self, handler)()
|
||||
trace_element.update_variables(self._variables)
|
||||
except Exception as ex: # pylint: disable=broad-except
|
||||
self._handle_exception(
|
||||
ex, continue_on_error, self._log_exceptions or log_exceptions
|
||||
)
|
||||
finally:
|
||||
trace_element.update_variables(self._variables)
|
||||
|
||||
def _finish(self) -> None:
|
||||
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}}
|
||||
variable_wait = dict(result_wait)
|
||||
expected_trace = {
|
||||
"0": [{"result": result_wait}],
|
||||
"0": [{"result": result_wait, "variables": variable_wait}],
|
||||
}
|
||||
if continue_on_timeout is False:
|
||||
expected_trace["0"][0]["result"]["timeout"] = True
|
||||
expected_trace["0"][0]["error"] = ""
|
||||
expected_script_execution = "aborted"
|
||||
else:
|
||||
expected_trace["0"][0]["variables"] = variable_wait
|
||||
expected_trace["1"] = [{"result": {"event": "test_event", "event_data": {}}}]
|
||||
expected_script_execution = "finished"
|
||||
assert_action_trace(expected_trace, expected_script_execution)
|
||||
|
|
Loading…
Add table
Reference in a new issue