litellm/tests/test_litellm/llms/custom_httpx
Julio Quinteros Pro 26f8e1ac0a fix(tests): resolve test isolation issue in http_handler tests
Fix isinstance() checks failing due to module reload in conftest.py.

The conftest.py fixture reloads the litellm module between test modules,
which causes class references imported at module-level to become stale.
When AsyncHTTPHandler is imported at the top of the file and then litellm
is reloaded by the fixture, the isinstance() check fails because the
returned instance is of the NEW AsyncHTTPHandler class while the test
is checking against the OLD class reference.

Solution: Import AsyncHTTPHandler locally within each test function that
uses isinstance() checks. This ensures we get the fresh class reference
after the module reload.

Fixed tests:
- test_session_reuse_integration
- test_get_async_httpx_client_with_shared_session
- test_get_async_httpx_client_without_shared_session

This resolves intermittent CI failures where parallel test execution
triggers the module reload behavior.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 19:01:02 -03:00
..
test_aiohttp_handler.py Fix linting 2025-09-07 18:04:00 -07:00
test_aiohttp_transport.py fix(aiohttp): prevent closing shared ClientSession in AiohttpTransport (#21117) 2026-02-16 18:28:28 +05:30
test_gemini_session_leak.py fix: HTTP client memory leaks in Presidio, OpenAI, and Gemini (#19190) 2026-01-19 19:02:55 -08:00
test_http_handler.py fix(tests): resolve test isolation issue in http_handler tests 2026-02-17 19:01:02 -03:00
test_llm_http_handler.py add tests 2025-12-01 14:25:37 -05:00