From b94b93cc633fd90b7abb1f4ccee554b6bb920836 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Sat, 27 Apr 2024 14:08:56 +0200 Subject: [PATCH] Make freezegun find event.time_tracker_utcnow (#116284) --- tests/patch_time.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/patch_time.py b/tests/patch_time.py index 3489d4a6baf..c8052b3b8ac 100644 --- a/tests/patch_time.py +++ b/tests/patch_time.py @@ -6,6 +6,7 @@ import datetime import time from homeassistant import runner, util +from homeassistant.helpers import event as event_helper from homeassistant.util import dt as dt_util @@ -19,6 +20,9 @@ def _monotonic() -> float: return time.monotonic() +# Replace partial functions which are not found by freezegun dt_util.utcnow = _utcnow # type: ignore[assignment] +event_helper.time_tracker_utcnow = _utcnow # type: ignore[assignment] util.utcnow = _utcnow # type: ignore[assignment] + runner.monotonic = _monotonic # type: ignore[assignment]