mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
Import tplink in the executor to avoid blocking the event loop (#111691)
* Import tplink in the executor to avoid blocking the event loop 2024-02-27 22:44:19.908 DEBUG (MainThread) [homeassistant.loader] Component tplink import took 1.620 seconds (loaded_executor=False) * patch out discovery because it happens too fast now
This commit is contained in:
parent
ee0f177153
commit
f71343a3ba
@ -266,6 +266,7 @@
|
||||
}
|
||||
],
|
||||
"documentation": "https://www.home-assistant.io/integrations/tplink",
|
||||
"import_executor": true,
|
||||
"iot_class": "local_polling",
|
||||
"loggers": ["kasa"],
|
||||
"quality_scale": "platinum",
|
||||
|
@ -740,8 +740,10 @@ async def test_integration_discovery_with_ip_change(
|
||||
"""Test reauth flow."""
|
||||
mock_connect["connect"].side_effect = SmartDeviceException()
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
with patch("homeassistant.components.tplink.Discover.discover", return_value={}):
|
||||
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert mock_config_entry.state == config_entries.ConfigEntryState.SETUP_RETRY
|
||||
|
||||
flows = hass.config_entries.flow.async_progress()
|
||||
@ -791,8 +793,9 @@ async def test_dhcp_discovery_with_ip_change(
|
||||
"""Test dhcp discovery with an IP change."""
|
||||
mock_connect["connect"].side_effect = SmartDeviceException()
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
with patch("homeassistant.components.tplink.Discover.discover", return_value={}):
|
||||
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
assert mock_config_entry.state == config_entries.ConfigEntryState.SETUP_RETRY
|
||||
|
||||
flows = hass.config_entries.flow.async_progress()
|
||||
@ -855,8 +858,9 @@ async def test_reauth_update_from_discovery(
|
||||
"""Test reauth flow."""
|
||||
mock_connect["connect"].side_effect = AuthenticationException
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
with patch("homeassistant.components.tplink.Discover.discover", return_value={}):
|
||||
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert mock_config_entry.state == config_entries.ConfigEntryState.SETUP_ERROR
|
||||
|
||||
@ -891,8 +895,9 @@ async def test_reauth_update_from_discovery_with_ip_change(
|
||||
"""Test reauth flow."""
|
||||
mock_connect["connect"].side_effect = AuthenticationException()
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
with patch("homeassistant.components.tplink.Discover.discover", return_value={}):
|
||||
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
assert mock_config_entry.state == config_entries.ConfigEntryState.SETUP_ERROR
|
||||
|
||||
flows = hass.config_entries.flow.async_progress()
|
||||
@ -1121,8 +1126,9 @@ async def test_reauth_update_other_flows(
|
||||
mock_connect["connect"].side_effect = AuthenticationException()
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
mock_config_entry2.add_to_hass(hass)
|
||||
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
with patch("homeassistant.components.tplink.Discover.discover", return_value={}):
|
||||
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert mock_config_entry2.state == config_entries.ConfigEntryState.SETUP_ERROR
|
||||
assert mock_config_entry.state == config_entries.ConfigEntryState.SETUP_ERROR
|
||||
|
Loading…
x
Reference in New Issue
Block a user