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

Method testUDPReceiveQuery

tests/test_query.py:252–261  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

250
251 @tests.util.retry_on_timeout
252 def testUDPReceiveQuery(self):
253 with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as listener:
254 listener.bind(("127.0.0.1", 0))
255 with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as sender:
256 sender.bind(("127.0.0.1", 0))
257 q = dns.message.make_query("dns.google", dns.rdatatype.A)
258 dns.query.send_udp(sender, q, listener.getsockname())
259 expiration = time.time() + 2
260 (q, _, addr) = dns.query.receive_udp(listener, expiration=expiration)
261 self.assertEqual(addr, sender.getsockname())
262
263
264# for brevity

Callers

nothing calls this directly

Calls 2

timeMethod · 0.80
getsocknameMethod · 0.45

Tested by

no test coverage detected