Test that connections have TCP_NODELAY turned on
(self)
| 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", |
nothing calls this directly
no test coverage detected