Import util.dt as dt_util in components/[a-d]* (#93756)

This commit is contained in:
Ville Skyttä
2023-05-30 00:02:06 +03:00
committed by GitHub
parent 5aadd7ffc9
commit ced67e5800
24 changed files with 121 additions and 105 deletions
@@ -5,7 +5,7 @@ from homeassistant.config_entries import RELOAD_AFTER_UPDATE_DELAY
from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from homeassistant.util import dt
from homeassistant.util import dt as dt_util
from . import (
TEST_SET_RESPONSE,
@@ -88,7 +88,7 @@ async def test_binary_sensor_async_setup_entry(
async_fire_time_changed(
hass,
dt.utcnow() + timedelta(seconds=RELOAD_AFTER_UPDATE_DELAY + 1),
dt_util.utcnow() + timedelta(seconds=RELOAD_AFTER_UPDATE_DELAY + 1),
)
await hass.async_block_till_done()
@@ -110,7 +110,7 @@ async def test_binary_sensor_async_setup_entry(
async_fire_time_changed(
hass,
dt.utcnow() + timedelta(seconds=RELOAD_AFTER_UPDATE_DELAY + 1),
dt_util.utcnow() + timedelta(seconds=RELOAD_AFTER_UPDATE_DELAY + 1),
)
await hass.async_block_till_done()
@@ -11,7 +11,7 @@ from homeassistant.config_entries import RELOAD_AFTER_UPDATE_DELAY
from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from homeassistant.util import dt
from homeassistant.util import dt as dt_util
from . import (
TEST_SET_RESPONSE,
@@ -144,7 +144,7 @@ async def test_sensor_platform(
async_fire_time_changed(
hass,
dt.utcnow() + timedelta(seconds=RELOAD_AFTER_UPDATE_DELAY + 1),
dt_util.utcnow() + timedelta(seconds=RELOAD_AFTER_UPDATE_DELAY + 1),
)
await hass.async_block_till_done()
+2 -2
View File
@@ -8,7 +8,7 @@ from anova_wifi import AnovaApi, AnovaOffline
from homeassistant.const import STATE_UNAVAILABLE
from homeassistant.core import HomeAssistant
from homeassistant.util import dt
from homeassistant.util import dt as dt_util
from . import async_init_integration
@@ -54,7 +54,7 @@ async def test_update_failed(hass: HomeAssistant, anova_api: AnovaApi) -> None:
"homeassistant.components.anova.AnovaPrecisionCooker.update",
side_effect=AnovaOffline(),
):
async_fire_time_changed(hass, dt.utcnow() + timedelta(seconds=61))
async_fire_time_changed(hass, dt_util.utcnow() + timedelta(seconds=61))
await hass.async_block_till_done()
state = hass.states.get("sensor.anova_precision_cooker_water_temperature")
+5 -5
View File
@@ -5,7 +5,7 @@ import pytest
from homeassistant.components.broadlink.heartbeat import BroadlinkHeartbeat
from homeassistant.core import HomeAssistant
from homeassistant.util import dt
from homeassistant.util import dt as dt_util
from . import get_device
@@ -48,7 +48,7 @@ async def test_heartbeat_trigger_right_time(hass: HomeAssistant) -> None:
with patch(DEVICE_PING) as mock_ping:
async_fire_time_changed(
hass, dt.utcnow() + BroadlinkHeartbeat.HEARTBEAT_INTERVAL
hass, dt_util.utcnow() + BroadlinkHeartbeat.HEARTBEAT_INTERVAL
)
await hass.async_block_till_done()
@@ -66,7 +66,7 @@ async def test_heartbeat_do_not_trigger_before_time(hass: HomeAssistant) -> None
with patch(DEVICE_PING) as mock_ping:
async_fire_time_changed(
hass,
dt.utcnow() + BroadlinkHeartbeat.HEARTBEAT_INTERVAL // 2,
dt_util.utcnow() + BroadlinkHeartbeat.HEARTBEAT_INTERVAL // 2,
)
await hass.async_block_till_done()
@@ -85,7 +85,7 @@ async def test_heartbeat_unload(hass: HomeAssistant) -> None:
with patch(DEVICE_PING) as mock_ping:
async_fire_time_changed(
hass, dt.utcnow() + BroadlinkHeartbeat.HEARTBEAT_INTERVAL
hass, dt_util.utcnow() + BroadlinkHeartbeat.HEARTBEAT_INTERVAL
)
assert mock_ping.call_count == 0
@@ -105,7 +105,7 @@ async def test_heartbeat_do_not_unload(hass: HomeAssistant) -> None:
with patch(DEVICE_PING) as mock_ping:
async_fire_time_changed(
hass, dt.utcnow() + BroadlinkHeartbeat.HEARTBEAT_INTERVAL
hass, dt_util.utcnow() + BroadlinkHeartbeat.HEARTBEAT_INTERVAL
)
await hass.async_block_till_done()
+4 -2
View File
@@ -7,7 +7,7 @@ from homeassistant.const import ATTR_FRIENDLY_NAME, Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import device_registry as dr, entity_registry as er
from homeassistant.helpers.entity_component import async_update_entity
from homeassistant.util import dt
from homeassistant.util import dt as dt_util
from . import get_device
@@ -384,7 +384,9 @@ async def test_scb1e_sensor_update(
}
target_time = (
dt.utcnow() + BroadlinkSP4UpdateManager.SCAN_INTERVAL * 3 + timedelta(seconds=1)
dt_util.utcnow()
+ BroadlinkSP4UpdateManager.SCAN_INTERVAL * 3
+ timedelta(seconds=1)
)
mock_setup = await device.setup_entry(hass, mock_api=mock_api)
+23 -13
View File
@@ -9,7 +9,7 @@ import pytest
from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component
from homeassistant.util import dt
from homeassistant.util import dt as dt_util
DEVICE_DATA = {"name": "Private Calendar", "device_id": "Private Calendar"}
@@ -360,7 +360,7 @@ def get_api_events(hass_client):
def _local_datetime(hours, minutes):
"""Build a datetime object for testing in the correct timezone."""
return dt.as_local(datetime.datetime(2017, 11, 27, hours, minutes, 0))
return dt_util.as_local(datetime.datetime(2017, 11, 27, hours, minutes, 0))
def _mocked_dav_client(*names, calendars=None):
@@ -693,7 +693,9 @@ async def test_all_day_event_returned_early(
hass,
calendar,
config,
datetime.datetime(2017, 11, 27, 0, 30).replace(tzinfo=dt.DEFAULT_TIME_ZONE),
datetime.datetime(2017, 11, 27, 0, 30).replace(
tzinfo=dt_util.DEFAULT_TIME_ZONE
),
)
@@ -711,7 +713,9 @@ async def test_all_day_event_returned_mid(
hass,
calendar,
config,
datetime.datetime(2017, 11, 27, 12, 30).replace(tzinfo=dt.DEFAULT_TIME_ZONE),
datetime.datetime(2017, 11, 27, 12, 30).replace(
tzinfo=dt_util.DEFAULT_TIME_ZONE
),
)
@@ -729,7 +733,9 @@ async def test_all_day_event_returned_late(
hass,
calendar,
config,
datetime.datetime(2017, 11, 27, 23, 30).replace(tzinfo=dt.DEFAULT_TIME_ZONE),
datetime.datetime(2017, 11, 27, 23, 30).replace(
tzinfo=dt_util.DEFAULT_TIME_ZONE
),
)
@@ -883,7 +889,7 @@ async def test_event_rrule_all_day_early(hass: HomeAssistant, calendar, set_tz)
hass,
calendar,
config,
datetime.datetime(2016, 12, 1, 0, 30).replace(tzinfo=dt.DEFAULT_TIME_ZONE),
datetime.datetime(2016, 12, 1, 0, 30).replace(tzinfo=dt_util.DEFAULT_TIME_ZONE),
)
@@ -899,7 +905,9 @@ async def test_event_rrule_all_day_mid(hass: HomeAssistant, calendar, set_tz) ->
hass,
calendar,
config,
datetime.datetime(2016, 12, 1, 17, 30).replace(tzinfo=dt.DEFAULT_TIME_ZONE),
datetime.datetime(2016, 12, 1, 17, 30).replace(
tzinfo=dt_util.DEFAULT_TIME_ZONE
),
)
@@ -915,14 +923,16 @@ async def test_event_rrule_all_day_late(hass: HomeAssistant, calendar, set_tz) -
hass,
calendar,
config,
datetime.datetime(2016, 12, 1, 23, 30).replace(tzinfo=dt.DEFAULT_TIME_ZONE),
datetime.datetime(2016, 12, 1, 23, 30).replace(
tzinfo=dt_util.DEFAULT_TIME_ZONE
),
)
@pytest.mark.parametrize("set_tz", ["utc"], indirect=True)
@patch(
"homeassistant.util.dt.now",
return_value=dt.as_local(datetime.datetime(2015, 11, 27, 0, 15)),
return_value=dt_util.as_local(datetime.datetime(2015, 11, 27, 0, 15)),
)
async def test_event_rrule_hourly_on_first(
mock_now, hass: HomeAssistant, calendar, set_tz
@@ -949,7 +959,7 @@ async def test_event_rrule_hourly_on_first(
@pytest.mark.parametrize("set_tz", ["utc"], indirect=True)
@patch(
"homeassistant.util.dt.now",
return_value=dt.as_local(datetime.datetime(2015, 11, 27, 11, 15)),
return_value=dt_util.as_local(datetime.datetime(2015, 11, 27, 11, 15)),
)
async def test_event_rrule_hourly_on_last(
mock_now, hass: HomeAssistant, calendar, set_tz
@@ -975,7 +985,7 @@ async def test_event_rrule_hourly_on_last(
@patch(
"homeassistant.util.dt.now",
return_value=dt.as_local(datetime.datetime(2015, 11, 27, 0, 45)),
return_value=dt_util.as_local(datetime.datetime(2015, 11, 27, 0, 45)),
)
async def test_event_rrule_hourly_off_first(
mock_now, hass: HomeAssistant, calendar
@@ -991,7 +1001,7 @@ async def test_event_rrule_hourly_off_first(
@patch(
"homeassistant.util.dt.now",
return_value=dt.as_local(datetime.datetime(2015, 11, 27, 11, 45)),
return_value=dt_util.as_local(datetime.datetime(2015, 11, 27, 11, 45)),
)
async def test_event_rrule_hourly_off_last(
mock_now, hass: HomeAssistant, calendar
@@ -1007,7 +1017,7 @@ async def test_event_rrule_hourly_off_last(
@patch(
"homeassistant.util.dt.now",
return_value=dt.as_local(datetime.datetime(2015, 11, 27, 12, 15)),
return_value=dt_util.as_local(datetime.datetime(2015, 11, 27, 12, 15)),
)
async def test_event_rrule_hourly_ended(
mock_now, hass: HomeAssistant, calendar
+2 -2
View File
@@ -1,12 +1,12 @@
"""Helpers for Cert Expiry tests."""
from datetime import datetime, timedelta
from homeassistant.util import dt
from homeassistant.util import dt as dt_util
def static_datetime():
"""Build a datetime object for testing in the correct timezone."""
return dt.as_utc(datetime(2020, 6, 12, 8, 0, 0))
return dt_util.as_utc(datetime(2020, 6, 12, 8, 0, 0))
def future_timestamp(days):
+3 -3
View File
@@ -10,7 +10,7 @@ from homeassistant.components.repairs import DOMAIN as REPAIRS_DOMAIN
from homeassistant.core import HomeAssistant
import homeassistant.helpers.issue_registry as ir
from homeassistant.setup import async_setup_component
from homeassistant.util import dt
from homeassistant.util import dt as dt_util
from . import mock_cloud
@@ -28,7 +28,7 @@ async def test_do_not_create_repair_issues_at_startup_if_not_logged_in(
with patch("homeassistant.components.cloud.Cloud.is_logged_in", False):
await mock_cloud(hass)
async_fire_time_changed(hass, dt.utcnow() + timedelta(hours=1))
async_fire_time_changed(hass, dt_util.utcnow() + timedelta(hours=1))
await hass.async_block_till_done()
assert not issue_registry.async_get_issue(
@@ -51,7 +51,7 @@ async def test_create_repair_issues_at_startup_if_logged_in(
with patch("homeassistant.components.cloud.Cloud.is_logged_in", True):
await mock_cloud(hass)
async_fire_time_changed(hass, dt.utcnow() + timedelta(hours=1))
async_fire_time_changed(hass, dt_util.utcnow() + timedelta(hours=1))
await hass.async_block_till_done()
assert issue_registry.async_get_issue(
+3 -3
View File
@@ -13,7 +13,7 @@ from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
import homeassistant.helpers.issue_registry as ir
from homeassistant.util import dt
from homeassistant.util import dt as dt_util
from tests.common import async_fire_time_changed
@@ -123,7 +123,7 @@ async def test_template_render(
# Give time for template to load
async_fire_time_changed(
hass,
dt.utcnow() + timedelta(minutes=1),
dt_util.utcnow() + timedelta(minutes=1),
)
await hass.async_block_till_done()
@@ -158,7 +158,7 @@ async def test_template_render_with_quote(hass: HomeAssistant) -> None:
# Give time for template to load
async_fire_time_changed(
hass,
dt.utcnow() + timedelta(minutes=1),
dt_util.utcnow() + timedelta(minutes=1),
)
await hass.async_block_till_done()
+2 -2
View File
@@ -24,7 +24,7 @@ from homeassistant.const import (
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers import device_registry as dr, entity_registry as er
from homeassistant.util import dt
from homeassistant.util import dt as dt_util
from .test_gateway import DECONZ_WEB_REQUEST, setup_deconz_integration
@@ -785,7 +785,7 @@ async def test_sensors(
async_fire_time_changed(
hass,
dt.utcnow() + timedelta(seconds=RELOAD_AFTER_UPDATE_DELAY + 1),
dt_util.utcnow() + timedelta(seconds=RELOAD_AFTER_UPDATE_DELAY + 1),
)
await hass.async_block_till_done()
+2 -2
View File
@@ -38,7 +38,7 @@ from homeassistant.const import (
)
from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component
from homeassistant.util import dt
from homeassistant.util import dt as dt_util
from tests.common import async_fire_time_changed, async_mock_service
from tests.components.vacuum import common
@@ -179,7 +179,7 @@ async def test_methods(hass: HomeAssistant) -> None:
state = hass.states.get(ENTITY_VACUUM_STATE)
assert state.state == STATE_RETURNING
async_fire_time_changed(hass, dt.utcnow() + timedelta(seconds=31))
async_fire_time_changed(hass, dt_util.utcnow() + timedelta(seconds=31))
await hass.async_block_till_done()
state = hass.states.get(ENTITY_VACUUM_STATE)
assert state.state == STATE_DOCKED
@@ -18,7 +18,7 @@ from homeassistant.const import (
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from homeassistant.util import dt
from homeassistant.util import dt as dt_util
from . import configure_integration
from .const import PLCNET_ATTACHED
@@ -66,7 +66,7 @@ async def test_update_attached_to_router(
mock_device.plcnet.async_get_network_overview = AsyncMock(
side_effect=DeviceUnavailable
)
async_fire_time_changed(hass, dt.utcnow() + LONG_UPDATE_INTERVAL)
async_fire_time_changed(hass, dt_util.utcnow() + LONG_UPDATE_INTERVAL)
await hass.async_block_till_done()
state = hass.states.get(state_key)
@@ -77,7 +77,7 @@ async def test_update_attached_to_router(
mock_device.plcnet.async_get_network_overview = AsyncMock(
return_value=PLCNET_ATTACHED
)
async_fire_time_changed(hass, dt.utcnow() + LONG_UPDATE_INTERVAL)
async_fire_time_changed(hass, dt_util.utcnow() + LONG_UPDATE_INTERVAL)
await hass.async_block_till_done()
state = hass.states.get(state_key)
@@ -18,7 +18,7 @@ from homeassistant.const import (
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from homeassistant.util import dt
from homeassistant.util import dt as dt_util
from . import configure_integration
from .const import CONNECTED_STATIONS, DISCOVERY_INFO, NO_CONNECTED_STATIONS
@@ -40,13 +40,13 @@ async def test_device_tracker(
entry = configure_integration(hass)
await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
async_fire_time_changed(hass, dt.utcnow() + LONG_UPDATE_INTERVAL)
async_fire_time_changed(hass, dt_util.utcnow() + LONG_UPDATE_INTERVAL)
await hass.async_block_till_done()
# Enable entity
entity_registry.async_update_entity(state_key, disabled_by=None)
await hass.async_block_till_done()
async_fire_time_changed(hass, dt.utcnow() + LONG_UPDATE_INTERVAL)
async_fire_time_changed(hass, dt_util.utcnow() + LONG_UPDATE_INTERVAL)
await hass.async_block_till_done()
state = hass.states.get(state_key)
@@ -62,7 +62,7 @@ async def test_device_tracker(
mock_device.device.async_get_wifi_connected_station = AsyncMock(
return_value=NO_CONNECTED_STATIONS
)
async_fire_time_changed(hass, dt.utcnow() + LONG_UPDATE_INTERVAL)
async_fire_time_changed(hass, dt_util.utcnow() + LONG_UPDATE_INTERVAL)
await hass.async_block_till_done()
state = hass.states.get(state_key)
@@ -73,7 +73,7 @@ async def test_device_tracker(
mock_device.device.async_get_wifi_connected_station = AsyncMock(
side_effect=DeviceUnavailable
)
async_fire_time_changed(hass, dt.utcnow() + LONG_UPDATE_INTERVAL)
async_fire_time_changed(hass, dt_util.utcnow() + LONG_UPDATE_INTERVAL)
await hass.async_block_till_done()
state = hass.states.get(state_key)
@@ -12,7 +12,7 @@ from homeassistant.components.sensor import DOMAIN, SensorStateClass
from homeassistant.const import ATTR_FRIENDLY_NAME, STATE_UNAVAILABLE, EntityCategory
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from homeassistant.util import dt
from homeassistant.util import dt as dt_util
from . import configure_integration
from .mock import MockDevice
@@ -57,7 +57,7 @@ async def test_update_connected_wifi_clients(
mock_device.device.async_get_wifi_connected_station = AsyncMock(
side_effect=DeviceUnavailable
)
async_fire_time_changed(hass, dt.utcnow() + SHORT_UPDATE_INTERVAL)
async_fire_time_changed(hass, dt_util.utcnow() + SHORT_UPDATE_INTERVAL)
await hass.async_block_till_done()
state = hass.states.get(state_key)
@@ -66,7 +66,7 @@ async def test_update_connected_wifi_clients(
# Emulate state change
mock_device.reset()
async_fire_time_changed(hass, dt.utcnow() + SHORT_UPDATE_INTERVAL)
async_fire_time_changed(hass, dt_util.utcnow() + SHORT_UPDATE_INTERVAL)
await hass.async_block_till_done()
state = hass.states.get(state_key)
@@ -103,7 +103,7 @@ async def test_update_neighboring_wifi_networks(
mock_device.device.async_get_wifi_neighbor_access_points = AsyncMock(
side_effect=DeviceUnavailable
)
async_fire_time_changed(hass, dt.utcnow() + LONG_UPDATE_INTERVAL)
async_fire_time_changed(hass, dt_util.utcnow() + LONG_UPDATE_INTERVAL)
await hass.async_block_till_done()
state = hass.states.get(state_key)
@@ -112,7 +112,7 @@ async def test_update_neighboring_wifi_networks(
# Emulate state change
mock_device.reset()
async_fire_time_changed(hass, dt.utcnow() + LONG_UPDATE_INTERVAL)
async_fire_time_changed(hass, dt_util.utcnow() + LONG_UPDATE_INTERVAL)
await hass.async_block_till_done()
state = hass.states.get(state_key)
@@ -148,7 +148,7 @@ async def test_update_connected_plc_devices(
mock_device.plcnet.async_get_network_overview = AsyncMock(
side_effect=DeviceUnavailable
)
async_fire_time_changed(hass, dt.utcnow() + LONG_UPDATE_INTERVAL)
async_fire_time_changed(hass, dt_util.utcnow() + LONG_UPDATE_INTERVAL)
await hass.async_block_till_done()
state = hass.states.get(state_key)
@@ -157,7 +157,7 @@ async def test_update_connected_plc_devices(
# Emulate state change
mock_device.reset()
async_fire_time_changed(hass, dt.utcnow() + LONG_UPDATE_INTERVAL)
async_fire_time_changed(hass, dt_util.utcnow() + LONG_UPDATE_INTERVAL)
await hass.async_block_till_done()
state = hass.states.get(state_key)
@@ -24,7 +24,7 @@ from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import entity_registry as er
from homeassistant.helpers.update_coordinator import REQUEST_REFRESH_DEFAULT_COOLDOWN
from homeassistant.util import dt
from homeassistant.util import dt as dt_util
from . import configure_integration
from .mock import MockDevice
@@ -90,7 +90,7 @@ async def test_update_enable_guest_wifi(
mock_device.device.async_get_wifi_guest_access.return_value = WifiGuestAccessGet(
enabled=True
)
async_fire_time_changed(hass, dt.utcnow() + SHORT_UPDATE_INTERVAL)
async_fire_time_changed(hass, dt_util.utcnow() + SHORT_UPDATE_INTERVAL)
await hass.async_block_till_done()
state = hass.states.get(state_key)
@@ -115,7 +115,7 @@ async def test_update_enable_guest_wifi(
turn_off.assert_called_once_with(False)
async_fire_time_changed(
hass, dt.utcnow() + timedelta(seconds=REQUEST_REFRESH_DEFAULT_COOLDOWN)
hass, dt_util.utcnow() + timedelta(seconds=REQUEST_REFRESH_DEFAULT_COOLDOWN)
)
await hass.async_block_till_done()
@@ -137,7 +137,7 @@ async def test_update_enable_guest_wifi(
turn_on.assert_called_once_with(True)
async_fire_time_changed(
hass, dt.utcnow() + timedelta(seconds=REQUEST_REFRESH_DEFAULT_COOLDOWN)
hass, dt_util.utcnow() + timedelta(seconds=REQUEST_REFRESH_DEFAULT_COOLDOWN)
)
await hass.async_block_till_done()
@@ -177,7 +177,7 @@ async def test_update_enable_leds(
# Emulate state change
mock_device.device.async_get_led_setting.return_value = True
async_fire_time_changed(hass, dt.utcnow() + SHORT_UPDATE_INTERVAL)
async_fire_time_changed(hass, dt_util.utcnow() + SHORT_UPDATE_INTERVAL)
await hass.async_block_till_done()
state = hass.states.get(state_key)
@@ -200,7 +200,7 @@ async def test_update_enable_leds(
turn_off.assert_called_once_with(False)
async_fire_time_changed(
hass, dt.utcnow() + timedelta(seconds=REQUEST_REFRESH_DEFAULT_COOLDOWN)
hass, dt_util.utcnow() + timedelta(seconds=REQUEST_REFRESH_DEFAULT_COOLDOWN)
)
await hass.async_block_till_done()
@@ -220,7 +220,7 @@ async def test_update_enable_leds(
turn_on.assert_called_once_with(True)
async_fire_time_changed(
hass, dt.utcnow() + timedelta(seconds=REQUEST_REFRESH_DEFAULT_COOLDOWN)
hass, dt_util.utcnow() + timedelta(seconds=REQUEST_REFRESH_DEFAULT_COOLDOWN)
)
await hass.async_block_till_done()
@@ -268,7 +268,7 @@ async def test_device_failure(
api = getattr(mock_device.device, get_method)
api.side_effect = DeviceUnavailable
async_fire_time_changed(hass, dt.utcnow() + update_interval)
async_fire_time_changed(hass, dt_util.utcnow() + update_interval)
await hass.async_block_till_done()
state = hass.states.get(state_key)
+2 -2
View File
@@ -17,7 +17,7 @@ from homeassistant.components.dnsip.const import (
from homeassistant.config_entries import SOURCE_USER
from homeassistant.const import CONF_NAME, STATE_UNAVAILABLE
from homeassistant.core import HomeAssistant
from homeassistant.util import dt
from homeassistant.util import dt as dt_util
from . import RetrieveDNS
@@ -97,7 +97,7 @@ async def test_sensor_no_response(hass: HomeAssistant) -> None:
):
async_fire_time_changed(
hass,
dt.utcnow() + timedelta(minutes=10),
dt_util.utcnow() + timedelta(minutes=10),
)
await hass.async_block_till_done()