Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update prometheus tests to avoid patching utcnow #93505

Merged
merged 1 commit into from
May 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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