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:
1 parent
00acb180d6
commit
7b016063ca
10 files changed
+84
-91
No files matched your search
@@ -3,12 +3,16 @@ import zeroconf
|
||||
|
||||
from homeassistant.components.zeroconf import async_get_instance
|
||||
from homeassistant.components.zeroconf.usage import install_multiple_zeroconf_catcher
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import Mock, patch
|
||||
|
||||
DOMAIN = "zeroconf"
|
||||
|
||||
|
||||
async def test_multiple_zeroconf_instances(hass, mock_zeroconf, caplog):
|
||||
"""Test creating multiple zeroconf throws without an integration."""
|
||||
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {}})
|
||||
|
||||
zeroconf_instance = await async_get_instance(hass)
|
||||
|
||||
@@ -22,6 +26,7 @@ async def test_multiple_zeroconf_instances(hass, mock_zeroconf, caplog):
|
||||
|
||||
async def test_multiple_zeroconf_instances_gives_shared(hass, mock_zeroconf, caplog):
|
||||
"""Test creating multiple zeroconf gives the shared instance to an integration."""
|
||||
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {}})
|
||||
|
||||
zeroconf_instance = await async_get_instance(hass)
|
||||
|
||||
|
||||
Reference in new issue
Block a user