Refactor zeroconf setup to be async (#39955)

* Refactor zeroconf setup to be async

Most of the setup was calling back to async because
we were setting up listeners.  Since we only need
to jump into the executor to create the zeroconf
instance, its much faster to setup in async.

In testing this cut the setup time in half
or better.

* partial revert to after_deps
This commit is contained in:
J. Nick Koston authored and GitHub committed 2020-09-13 18:06:19 -05:00
1 parent 00acb180d6
commit 7b016063ca
10 files changed
+84 -91

No files matched your search

@@ -1,4 +1,5 @@
"""Test Home Assistant Cast."""
from homeassistant.components.cast import home_assistant_cast
from homeassistant.config import async_process_ha_core_config
@@ -6,7 +7,7 @@ from tests.async_mock import patch
from tests.common import MockConfigEntry, async_mock_signal
async def test_service_show_view(hass):
async def test_service_show_view(hass, mock_zeroconf):
"""Test we don't set app id in prod."""
await async_process_ha_core_config(
hass,
@@ -33,7 +34,7 @@ async def test_service_show_view(hass):
assert url_path is None
async def test_service_show_view_dashboard(hass):
async def test_service_show_view_dashboard(hass, mock_zeroconf):
"""Test casting a specific dashboard."""
await async_process_ha_core_config(
hass,
@@ -60,7 +61,7 @@ async def test_service_show_view_dashboard(hass):
assert url_path == "mock-dashboard"
async def test_use_cloud_url(hass):
async def test_use_cloud_url(hass, mock_zeroconf):
"""Test that we fall back to cloud url."""
await async_process_ha_core_config(
hass,