MCPcopy Create free account
hub / github.com/rthalley/dnspython / testResolverTimeout

Function testResolverTimeout

tests/test_resolver.py:1179–1199  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1177 reason="Internet and NanoAuth required",
1178)
1179def testResolverTimeout():
1180 with DroppingNanoNameserver() as na:
1181 res = dns.resolver.Resolver(configure=False)
1182 res.port = na.udp_address[1]
1183 res.nameservers = [na.udp_address[0]]
1184 res.timeout = 0.2
1185 try:
1186 lifetime = 1.0
1187 a = res.resolve("www.dnspython.org", lifetime=lifetime)
1188 assert False # should never happen
1189 except dns.resolver.LifetimeTimeout as e:
1190 assert e.kwargs["timeout"] >= lifetime
1191 # The length of errors can vary based on how slow things are,
1192 # but it ought to be > 1, so we assert that.
1193 errors = e.kwargs["errors"]
1194 assert len(errors) > 1
1195 for error in errors:
1196 assert str(error[0]) == f"Do53:{na.udp_address[0]}@{na.udp_address[1]}"
1197 assert not error[1] # not TCP
1198 assert error[2] == na.udp_address[1] # port
1199 assert isinstance(error[3], dns.exception.Timeout) # exception
1200
1201
1202@pytest.mark.skipif(

Callers

nothing calls this directly

Calls 2

resolveMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…