MCPcopy Index your code
hub / github.com/python/cpython / test_socket

Function test_socket

Lib/test/audit-tests.py:400–419  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

398
399
400def test_socket():
401 import socket
402
403 def hook(event, args):
404 if event.startswith("socket."):
405 print(event, *args)
406
407 sys.addaudithook(hook)
408
409 socket.gethostname()
410
411 # Don't care if this fails, we just want the audit message
412 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
413 try:
414 # Don't care if this fails, we just want the audit message
415 sock.bind(('127.0.0.1', 8080))
416 except Exception:
417 pass
418 finally:
419 sock.close()
420
421
422def test_gc():

Callers

nothing calls this directly

Calls 3

socketMethod · 0.80
bindMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…