MCPcopy
hub / github.com/benoitc/gunicorn / test_connect_success

Method test_connect_success

tests/ctl/test_client.py:47–64  ·  view source on GitHub ↗

Test successful connection.

(self)

Source from the content-addressed store, hash-verified

45 assert "Failed to connect" in str(exc_info.value)
46
47 def test_connect_success(self):
48 """Test successful connection."""
49 with tempfile.TemporaryDirectory() as tmpdir:
50 socket_path = os.path.join(tmpdir, "test.sock")
51
52 # Create a listening socket
53 server_sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
54 server_sock.bind(socket_path)
55 server_sock.listen(1)
56
57 try:
58 client = ControlClient(socket_path)
59 client.connect()
60
61 assert client._sock is not None
62 client.close()
63 finally:
64 server_sock.close()
65
66 def test_connect_already_connected(self):
67 """Test that connect is idempotent."""

Callers

nothing calls this directly

Calls 5

connectMethod · 0.95
closeMethod · 0.95
ControlClientClass · 0.90
bindMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected