From 8fb89854d39d3bb8467cb1cc7f42edb39388d0a3 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 7 Apr 2020 10:13:55 -0700 Subject: [PATCH] Fix flaky TP-Link test (#33790) --- homeassistant/components/tplink/light.py | 12 ------------ homeassistant/components/tplink/switch.py | 11 ----------- tests/components/tplink/test_init.py | 2 ++ 3 files changed, 2 insertions(+), 23 deletions(-) diff --git a/homeassistant/components/tplink/light.py b/homeassistant/components/tplink/light.py index 7e07f7931f5..14d6b362dca 100644 --- a/homeassistant/components/tplink/light.py +++ b/homeassistant/components/tplink/light.py @@ -35,23 +35,11 @@ ATTR_DAILY_ENERGY_KWH = "daily_energy_kwh" ATTR_MONTHLY_ENERGY_KWH = "monthly_energy_kwh" -async def async_setup_platform(hass, config, add_entities, discovery_info=None): - """Set up the platform. - - Deprecated. - """ - _LOGGER.warning( - "Loading as a platform is no longer supported, " - "convert to use the tplink component." - ) - - async def async_setup_entry(hass: HomeAssistantType, config_entry, async_add_entities): """Set up switches.""" await async_add_entities_retry( hass, async_add_entities, hass.data[TPLINK_DOMAIN][CONF_LIGHT], add_entity ) - return True diff --git a/homeassistant/components/tplink/switch.py b/homeassistant/components/tplink/switch.py index b6ca69f4ccd..59d993477df 100644 --- a/homeassistant/components/tplink/switch.py +++ b/homeassistant/components/tplink/switch.py @@ -24,17 +24,6 @@ ATTR_TOTAL_ENERGY_KWH = "total_energy_kwh" ATTR_CURRENT_A = "current_a" -async def async_setup_platform(hass, config, add_entities, discovery_info=None): - """Set up the platform. - - Deprecated. - """ - _LOGGER.warning( - "Loading as a platform is no longer supported, " - "convert to use the tplink component." - ) - - def add_entity(device: SmartPlug, async_add_entities): """Check if device is online and add the entity.""" # Attempt to get the sysinfo. If it fails, it will raise an diff --git a/tests/components/tplink/test_init.py b/tests/components/tplink/test_init.py index d30a05ddbf8..85bf0781864 100644 --- a/tests/components/tplink/test_init.py +++ b/tests/components/tplink/test_init.py @@ -116,6 +116,8 @@ async def test_configuring_devices_from_multiple_sources(hass): "homeassistant.components.tplink.common.Discover.discover" ) as discover, patch( "homeassistant.components.tplink.common.SmartDevice._query_helper" + ), patch( + "homeassistant.config_entries.ConfigEntries.async_forward_entry_setup" ): discover_device_fail = SmartPlug("123.123.123.123") discover_device_fail.get_sysinfo = MagicMock(side_effect=SmartDeviceException())