Skip to content

Commit 7f49c61

Browse files
committed
Merge remote-tracking branch 'upstream/master' into abtract_query_scheduler
2 parents 8ece209 + a7b4f8e commit 7f49c61

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

tests/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ async def _wait_for_response():
4141
asyncio.run_coroutine_threadsafe(_wait_for_response(), zc.loop).result()
4242

4343

44+
def _wait_for_start(zc: Zeroconf) -> None:
45+
"""Wait for all sockets to be up and running."""
46+
assert zc.loop is not None
47+
asyncio.run_coroutine_threadsafe(zc.async_wait_for_start(), zc.loop).result()
48+
49+
4450
@lru_cache(maxsize=None)
4551
def has_working_ipv6():
4652
"""Return True if if the system can bind an IPv6 address."""

tests/services/test_browser.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from zeroconf._services.info import ServiceInfo
2424
from zeroconf.aio import AsyncZeroconf
2525

26-
from .. import has_working_ipv6, _inject_response
26+
from .. import has_working_ipv6, _inject_response, _wait_for_start
2727

2828

2929
log = logging.getLogger('zeroconf')
@@ -436,6 +436,7 @@ def test_backoff(suppresses_mock):
436436

437437
type_ = "_http._tcp.local."
438438
zeroconf_browser = Zeroconf(interfaces=['127.0.0.1'])
439+
_wait_for_start(zeroconf_browser)
439440

440441
# we are going to patch the zeroconf send to check query transmission
441442
old_send = zeroconf_browser.async_send
@@ -509,6 +510,7 @@ def test_first_query_delay():
509510
"""
510511
type_ = "_http._tcp.local."
511512
zeroconf_browser = Zeroconf(interfaces=['127.0.0.1'])
513+
_wait_for_start(zeroconf_browser)
512514

513515
# we are going to patch the zeroconf send to check query transmission
514516
old_send = zeroconf_browser.async_send
@@ -662,6 +664,7 @@ def on_service_state_change(zeroconf, service_type, state_change, name):
662664
service_removed.set()
663665

664666
zeroconf_browser = Zeroconf(interfaces=['127.0.0.1'])
667+
_wait_for_start(zeroconf_browser)
665668

666669
# we are going to patch the zeroconf send to check packet sizes
667670
old_send = zeroconf_browser.async_send

0 commit comments

Comments
 (0)