Make freezegun find event.time_tracker_utcnow (#116284)

pull/116298/head
Erik Montnemery 2024-04-27 14:08:56 +02:00 committed by GitHub
parent 7715bee6b0
commit b94b93cc63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -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]