Update prometheus tests to avoid patching utcnow (#93505)
This commit is contained in:
parent
2bb46c8a9e
commit
c63e3c3bf1
1 changed files with 2 additions and 4 deletions
|
@ -5,6 +5,7 @@ from http import HTTPStatus
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
|
from freezegun import freeze_time
|
||||||
import prometheus_client
|
import prometheus_client
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
@ -941,10 +942,7 @@ async def sensor_fixture(
|
||||||
suggested_object_id="radio_energy",
|
suggested_object_id="radio_energy",
|
||||||
original_name="Radio Energy",
|
original_name="Radio Energy",
|
||||||
)
|
)
|
||||||
with mock.patch(
|
with freeze_time(datetime.datetime(1970, 1, 2, tzinfo=dt_util.UTC)):
|
||||||
"homeassistant.util.dt.utcnow",
|
|
||||||
return_value=datetime.datetime(1970, 1, 2, tzinfo=dt_util.UTC),
|
|
||||||
):
|
|
||||||
set_state_with_entry(hass, sensor_3, 14)
|
set_state_with_entry(hass, sensor_3, 14)
|
||||||
data["sensor_3"] = sensor_3
|
data["sensor_3"] = sensor_3
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue