MCPcopy
hub / github.com/urllib3/urllib3 / test_put_conn_closed_pool

Method test_put_conn_closed_pool

test/test_connectionpool.py:280–292  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

278 assert conn1 == pool._get_conn()
279
280 def test_put_conn_closed_pool(self) -> None:
281 with HTTPConnectionPool(host="localhost", maxsize=1, block=True) as pool:
282 conn1 = pool._get_conn()
283 with patch.object(conn1, "close") as conn1_close:
284 pool.close()
285
286 assert pool.pool is None
287
288 # Accessing pool.pool will raise AttributeError, which will get
289 # caught and will close conn1
290 pool._put_conn(conn1)
291
292 assert conn1_close.called is True
293
294 def test_exception_str(self) -> None:
295 assert (

Callers

nothing calls this directly

Calls 4

HTTPConnectionPoolClass · 0.90
_get_connMethod · 0.80
_put_connMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected