MCPcopy
hub / github.com/urllib3/urllib3 / _test

Method _test

test/test_connectionpool.py:324–335  ·  view source on GitHub ↗
(
                exception: type[BaseException],
                expect: type[BaseException],
                reason: type[BaseException] | None = None,
            )

Source from the content-addressed store, hash-verified

322 ) as pool:
323
324 def _test(
325 exception: type[BaseException],
326 expect: type[BaseException],
327 reason: type[BaseException] | None = None,
328 ) -> None:
329 with patch.object(pool, "_make_request", side_effect=exception()):
330 with pytest.raises(expect) as excinfo:
331 pool.request("GET", "/")
332 if reason is not None:
333 assert isinstance(excinfo.value.reason, reason) # type: ignore[attr-defined]
334 assert pool.pool is not None
335 assert pool.pool.qsize() == POOL_SIZE
336
337 # Make sure that all of the exceptions return the connection
338 # to the pool

Callers

nothing calls this directly

Calls 5

HTTPConnectionPoolClass · 0.90
requestMethod · 0.45
urlopenMethod · 0.45
release_connMethod · 0.45

Tested by

no test coverage detected