Skip to content

Commit e3eedba

Browse files
committed
test: widen QM-follow-up window in info_asking_default test
The 50ms QUICK_REQUEST_TIMEOUT_MS budget for this test left ~35ms of headroom for the QM query that fires ~11-15ms after the QU; on macOS-latest skip_cython runs the asyncio short-sleep quantization occasionally pushed the wake past the 50ms cap, so the loop returned before the QM was sent and second_outgoing stayed None. The test only asserts that the second outgoing query is QM, the exact wall-clock budget is not part of the contract, so bump this test's timeout to 300ms; that absorbs macOS scheduling jitter without leaning on the shared QUICK_REQUEST_TIMEOUT_MS constant other tests rely on.
1 parent 90a5a39 commit e3eedba

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

tests/test_asyncio.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444

4545
from . import (
4646
LOOPBACK_FIND_TIMEOUT,
47-
QUICK_REQUEST_TIMEOUT_MS,
4847
QuestionHistoryWithoutSuppression,
4948
_clear_cache,
5049
has_working_ipv6,
@@ -1191,10 +1190,12 @@ def send(out, addr=const._MDNS_ADDR, port=const._MDNS_PORT):
11911190
with patch.object(zeroconf_info, "async_send", send):
11921191
aiosinfo = AsyncServiceInfo(type_, registration_name)
11931192
# Patch _is_complete so we send multiple times. Under
1194-
# `quick_request_timing` both the QU query at 0ms and the QM
1195-
# query at ~15ms land well inside QUICK_REQUEST_TIMEOUT_MS.
1193+
# `quick_request_timing` the QU query fires at 0ms and the QM
1194+
# follow-up at ~11-15ms (10ms _LISTENER_TIME + 1-5ms jitter);
1195+
# 300ms absorbs macOS short-sleep quantization so the QM wake
1196+
# lands before the loop times out.
11961197
with patch("zeroconf.asyncio.AsyncServiceInfo._is_complete", False):
1197-
await aiosinfo.async_request(aiozc.zeroconf, QUICK_REQUEST_TIMEOUT_MS)
1198+
await aiosinfo.async_request(aiozc.zeroconf, 300)
11981199
try:
11991200
assert first_outgoing.questions[0].unicast is True # type: ignore[union-attr]
12001201
assert second_outgoing.questions[0].unicast is False # type: ignore[attr-defined]

0 commit comments

Comments
 (0)