MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_reuse_port

Method test_reuse_port

Lib/test/test_socket.py:7276–7286  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

7274 self.assertEqual(sock.type, socket.SOCK_STREAM)
7275
7276 def test_reuse_port(self):
7277 if not hasattr(socket, "SO_REUSEPORT"):
7278 with self.assertRaises(ValueError):
7279 socket.create_server(("localhost", 0), reuse_port=True)
7280 else:
7281 with socket.create_server(("localhost", 0)) as sock:
7282 opt = sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT)
7283 self.assertEqual(opt, 0)
7284 with socket.create_server(("localhost", 0), reuse_port=True) as sock:
7285 opt = sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT)
7286 self.assertNotEqual(opt, 0)
7287
7288 @unittest.skipIf(not hasattr(_socket, 'IPPROTO_IPV6') or
7289 not hasattr(_socket, 'IPV6_V6ONLY'),

Callers

nothing calls this directly

Calls 6

hasattrFunction · 0.85
assertNotEqualMethod · 0.80
assertRaisesMethod · 0.45
create_serverMethod · 0.45
getsockoptMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected