Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/services/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def mock_incoming_msg(
zeroconf,
mock_incoming_msg(r.ServiceStateChange.Added, service_types[1], service_names[1], 120),
)
zeroconf.wait(100)
time.sleep(0.1)

called_with_refresh_time_check = False

Expand Down Expand Up @@ -693,7 +693,7 @@ def on_service_state_change(zeroconf, service_type, state_change, name):

zc.register_service(info_service)

zc.wait(1)
time.sleep(0.001)

browser.cancel()

Expand Down
5 changes: 3 additions & 2 deletions tests/test_updates.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/env python


""" Unit tests for zeroconf._services. """
""" Unit tests for zeroconf._updates. """

import logging
import socket
import time
from threading import Event

import pytest
Expand Down Expand Up @@ -77,7 +78,7 @@ def on_service_state_change(zeroconf, service_type, state_change, name):

zc.register_service(info_service)

zc.wait(1)
time.sleep(0.001)

browser.cancel()

Expand Down
10 changes: 0 additions & 10 deletions zeroconf/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
"""

import asyncio
import concurrent.futures
import contextlib
import itertools
import random
import socket
Expand Down Expand Up @@ -423,14 +421,6 @@ def done(self) -> bool:
def listeners(self) -> List[RecordUpdateListener]:
return self.record_manager.listeners

def wait(self, timeout: float) -> None:
"""Calling task waits for a given number of milliseconds or until notified."""
assert self.loop is not None
with contextlib.suppress(concurrent.futures.TimeoutError):
asyncio.run_coroutine_threadsafe(self.async_wait(timeout), self.loop).result(
millis_to_seconds(timeout)
)

async def async_wait(self, timeout: float) -> None:
"""Calling task waits for a given number of milliseconds or until notified."""
assert self.notify_event is not None
Expand Down