MCPcopy
hub / github.com/urllib3/urllib3 / test_response_after_drain_conn

Function test_response_after_drain_conn

test/with_dummyserver/test_connection.py:143–159  ·  view source on GitHub ↗

Test that a connection can be reused after calling `drain_conn` on an unread response.

(pool: HTTPConnectionPool)

Source from the content-addressed store, hash-verified

141
142
143def test_response_after_drain_conn(pool: HTTPConnectionPool) -> None:
144 """
145 Test that a connection can be reused after calling `drain_conn` on
146 an unread response.
147 """
148 conn = pool._get_conn()
149
150 conn.request("GET", "/", preload_content=False)
151 response = conn.getresponse()
152 assert response.status == 200
153 response.drain_conn()
154
155 conn.request("GET", "/", preload_content=False)
156 response = conn.getresponse()
157 assert response.status == 200
158
159 conn.close()

Callers

nothing calls this directly

Calls 5

_get_connMethod · 0.80
requestMethod · 0.45
getresponseMethod · 0.45
drain_connMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected