Skip to content

Commit

Permalink
Update prometheus tests to avoid patching utcnow (#93505)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed May 25, 2023
1 parent 2bb46c8 commit c63e3c3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tests/components/prometheus/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typing import Any
from unittest import mock

from freezegun import freeze_time
import prometheus_client
import pytest

Expand Down Expand Up @@ -941,10 +942,7 @@ async def sensor_fixture(
suggested_object_id="radio_energy",
original_name="Radio Energy",
)
with mock.patch(
"homeassistant.util.dt.utcnow",
return_value=datetime.datetime(1970, 1, 2, tzinfo=dt_util.UTC),
):
with freeze_time(datetime.datetime(1970, 1, 2, tzinfo=dt_util.UTC)):
set_state_with_entry(hass, sensor_3, 14)
data["sensor_3"] = sensor_3

Expand Down

0 comments on commit c63e3c3

Please sign in to comment.