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
8 changes: 4 additions & 4 deletions tests/services/test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -1050,12 +1050,12 @@ def test_request_timeout():
"""Test that the timeout does not throw an exception and finishes close to the actual timeout."""
zeroconf = r.Zeroconf(interfaces=["127.0.0.1"])
start_time = r.current_time_millis()
assert zeroconf.get_service_info("_notfound.local.", "notthere._notfound.local.") is None
assert zeroconf.get_service_info("_notfound.local.", "notthere._notfound.local.", timeout=200) is None
end_time = r.current_time_millis()
zeroconf.close()
# 3000ms for the default timeout
# 200ms for the timeout passed above
# 1000ms for loaded systems + schedule overhead
assert (end_time - start_time) < 3000 + 1000
assert (end_time - start_time) < 200 + 1000


@pytest.mark.asyncio
Expand Down Expand Up @@ -1888,7 +1888,7 @@ def async_send(out: DNSOutgoing, addr: str | None = None, port: int = const._MDN
# patch the zeroconf send
with patch.object(aiozc.zeroconf, "async_send", async_send):
await aiozc.async_get_service_info(
f"willnotbefound.{type_}", type_, question_type=r.DNSQuestionType.QU
f"willnotbefound.{type_}", type_, timeout=200, question_type=r.DNSQuestionType.QU
)

await aiozc.async_close()
9 changes: 6 additions & 3 deletions tests/test_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -1276,12 +1276,15 @@ async def test_async_request_timeout():
aiozc = AsyncZeroconf(interfaces=["127.0.0.1"])
await aiozc.zeroconf.async_wait_for_start()
start_time = current_time_millis()
assert await aiozc.async_get_service_info("_notfound.local.", "notthere._notfound.local.") is None
assert (
await aiozc.async_get_service_info("_notfound.local.", "notthere._notfound.local.", timeout=200)
is None
)
end_time = current_time_millis()
await aiozc.async_close()
# 3000ms for the default timeout
# 200ms for the timeout passed above
# 1000ms for loaded systems + schedule overhead
assert (end_time - start_time) < 3000 + 1000
assert (end_time - start_time) < 200 + 1000


@pytest.mark.asyncio
Expand Down
Loading