Use built-in test helpers on 3.8 (#34901)

This commit is contained in:
Paulus Schoutsen
2020-04-30 13:29:50 -07:00
committed by GitHub
parent 6b16c34fd0
commit ec47216388
303 changed files with 1163 additions and 1320 deletions
+3 -4
View File
@@ -2,9 +2,7 @@
import asyncio
from datetime import timedelta
import logging
from unittest.mock import MagicMock, Mock, patch
import asynctest
import pytest
from homeassistant.const import UNIT_PERCENTAGE
@@ -18,6 +16,7 @@ from homeassistant.helpers.entity_component import (
)
import homeassistant.util.dt as dt_util
from tests.async_mock import Mock, patch
from tests.common import (
MockConfigEntry,
MockEntity,
@@ -136,7 +135,7 @@ async def test_update_state_adds_entities_with_update_before_add_false(hass):
assert not ent.update.called
@asynctest.patch("homeassistant.helpers.entity_platform.async_track_time_interval")
@patch("homeassistant.helpers.entity_platform.async_track_time_interval")
async def test_set_scan_interval_via_platform(mock_track, hass):
"""Test the setting of the scan interval via platform."""
@@ -183,7 +182,7 @@ async def test_platform_warn_slow_setup(hass):
component = EntityComponent(_LOGGER, DOMAIN, hass)
with patch.object(hass.loop, "call_later", MagicMock()) as mock_call:
with patch.object(hass.loop, "call_later") as mock_call:
await component.async_setup({DOMAIN: {"platform": "platform"}})
assert mock_call.called