Skip to content

Commit 79e39c0

Browse files
authored
Use cache clear helper in aio tests (#648)
1 parent cf0b5b9 commit 79e39c0

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

tests/test_aio.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
from zeroconf._utils.time import current_time_millis
2020

2121

22+
from . import _clear_cache
23+
24+
2225
@pytest.fixture(autouse=True)
2326
def verify_threads_ended():
2427
"""Verify that the threads are not running after the test."""
@@ -387,10 +390,7 @@ async def test_service_info_async_request() -> None:
387390
assert aiosinfos[1].addresses == [socket.inet_aton("10.0.1.5")]
388391

389392
aiosinfo = AsyncServiceInfo(type_, registration_name)
390-
zc_cache = aiozc.zeroconf.cache
391-
for name in zc_cache.names():
392-
for record in zc_cache.entries_with_name(name):
393-
zc_cache.remove(record)
393+
_clear_cache(aiozc.zeroconf)
394394
# Generating the race condition is almost impossible
395395
# without patching since its a TOCTOU race
396396
with unittest.mock.patch("zeroconf.aio.AsyncServiceInfo._is_complete", False):

0 commit comments

Comments
 (0)