MCPcopy
hub / github.com/urllib3/urllib3 / test_nagle

Method test_nagle

test/with_dummyserver/test_connectionpool.py:307–320  ·  view source on GitHub ↗

Test that connections have TCP_NODELAY turned on

(self)

Source from the content-addressed store, hash-verified

305 assert r.status == 200, r.data
306
307 def test_nagle(self) -> None:
308 """Test that connections have TCP_NODELAY turned on"""
309 # This test needs to be here in order to be run. socket.create_connection actually tries
310 # to connect to the host provided so we need a dummyserver to be running.
311 with HTTPConnectionPool(self.host, self.port) as pool:
312 conn = pool._get_conn()
313 try:
314 pool._make_request(conn, "GET", "/")
315 tcp_nodelay_setting = conn.sock.getsockopt( # type: ignore[attr-defined]
316 socket.IPPROTO_TCP, socket.TCP_NODELAY
317 )
318 assert tcp_nodelay_setting
319 finally:
320 conn.close()
321
322 @pytest.mark.parametrize(
323 "socket_options",

Callers

nothing calls this directly

Calls 4

HTTPConnectionPoolClass · 0.90
_get_connMethod · 0.80
_make_requestMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected