litellm/tests
Ishaan Jaff 2ea9e207bd
Litellm ishaan march 20 (#24303)
* feat(redis): add circuit breaker to RedisCache to fast-fail when Redis is down (#24181)

* feat(redis): add circuit breaker env var constants

* feat(redis): add RedisCircuitBreaker and apply guard decorator to all async ops

* fix(dual_cache): fall back to L1 instead of re-raising on Redis increment failures

* test(caching): add circuit breaker unit tests

* fix(redis): fast-fail concurrent HALF_OPEN probes — only one probe at a time

* fix(dual_cache): return None fallback when in_memory_cache is absent and Redis fails

* test(caching): add regression tests for HALF_OPEN concurrency and None fallback

* Fix blocking sync next in __anext__ (#24177)

* Fix blocking sync next

* Update tests/test_litellm/litellm_core_utils/test_streaming_handler.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix PEP 479 regression in __anext__ sync iterator exhaustion

asyncio.to_thread re-raises thread exceptions inside a coroutine, where
PEP 479 converts StopIteration to RuntimeError before any except clause
can catch it. Add _next_sync_or_exhausted() module-level helper that
catches StopIteration in the thread and returns a sentinel instead, then
raise StopAsyncIteration in the coroutine.

Also rewrites the non-blocking test to use asyncio.gather() instead of
asyncio.create_task() (which returned None on Python 3.9 / pytest-asyncio
in CI), and adds an exhaustion regression test that drains the wrapper
fully and asserts no RuntimeError leaks out.

---------

Co-authored-by: Emerson Gomes <emerson.gomes@thalesgroup.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* feat: add git-subdir source type to claude-code/plugins API (#24223)

Support a third plugin source type `git-subdir` alongside the existing
`github` and `url` types, as documented in the official Claude Code
plugin marketplaces spec.

New format: {"source": "git-subdir", "url": "...", "path": "subdir/path"}

- Validates url and path fields are present and non-empty
- Rejects absolute paths, '..' segments, backslashes, and percent-encoded
  traversal sequences (including double-encoded variants via regex check)
- Extracts path validation into _validate_git_subdir_path() helper
- Updates Pydantic field description to document all three source types
- Adds isValidUrl() check for url/git-subdir source types in the UI form
- Adds "Git Subdir" option to the UI form with a required Path field
- Adds unit tests covering success, update, missing/empty fields,
  path traversal variants, and unknown source type

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>

* [FEAT] add extract_header and extract_footer to Mistral OCR supported params (#24213)

* docs: add git-subdir source type to claude-code plugin marketplace docs (#24289)

* fix(ui): swap J/K keyboard navigation in log details drawer (#24279) (#24286)

J should navigate down (next) and K should navigate up (previous),
matching vim/standard conventions.

* fix: use async_set_cache in user_api_key_auth hot path (#24302)

* fix: use async_set_cache in auth hot path to avoid blocking event loop

* test: assert no blocking set_cache call in _user_api_key_auth_builder

* test: broaden blocking call check to all sync DualCache methods

* test: fix regression test to actually catch blocking cache calls

* fix: ruff lint unused variable + UI build MessageManager error

- litellm/caching/redis_cache.py: remove unused variable 'e' in circuit
  breaker exception handler (F841)
- add_plugin_form.tsx: use MessageManager.error() instead of undefined
  message.error() for git URL validation

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>

* docs: add REDIS_CIRCUIT_BREAKER env vars to config_settings reference

Add REDIS_CIRCUIT_BREAKER_FAILURE_THRESHOLD and
REDIS_CIRCUIT_BREAKER_RECOVERY_TIMEOUT to the environment variables
reference table so test_env_keys.py passes.

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>

---------

Co-authored-by: Emerson Gomes <emerson.gomes@thalesgroup.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Vincenzo Barrea <manamana88@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Robert Kirscht <rkirscht242@gmail.com>
Co-authored-by: Imgyu Kim <kimimgo@gmail.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
2026-03-21 12:40:11 -07:00
..
agent_tests [Release Fix] (#22411) 2026-02-28 09:46:35 -08:00
audio_tests
basic_proxy_startup_tests CircleCI test stability (#23055) 2026-03-07 15:19:39 -08:00
batches_tests Fix flaky batch tests: mock vertex auth and skip on DNS failure 2026-03-15 18:37:40 -07:00
benchmarks Add CodSpeed performance benchmarks (#23676) 2026-03-14 18:44:36 -07:00
code_coverage_tests [Fix] Add max_depth guard to BFL _read_image_bytes recursive function 2026-03-12 13:22:56 -07:00
documentation_tests fix failing tests 2026-02-21 15:48:26 -08:00
enterprise Fix downloading vertex ai files 2026-03-16 12:08:06 +05:30
guardrails_tests Optimize CI: parallelize router and guardrails test jobs, fix test isolation 2026-03-14 22:54:44 -07:00
image_gen_tests fix(ci): remove unused is_expired variable (ruff F841) and handle ModelDeprecated in image gen test 2026-03-12 01:27:42 +00:00
litellm fix(gemini-embeddings): convert task_type to camelCase taskType for Gemini API (#24191) 2026-03-20 22:32:22 +05:30
litellm-proxy-extras fix: prisma migrate deploy failures on pre-existing instances (#23655) 2026-03-14 16:54:21 -07:00
litellm_core_utils Fix: empty assistant message for converse API 2026-02-04 09:50:58 +05:30
litellm_utils_tests Update tests/litellm_utils_tests/test_bedrock_token_counter.py 2026-03-20 22:21:22 +09:00
llm_responses_api_testing fix: address greptile feedback 2026-03-18 21:36:39 -07:00
llm_translation Merge remote main into litellm_ci_optimize 2026-03-16 00:50:22 -07:00
load_tests Add memory leak detection tests with CI integration (#18881) 2026-01-09 17:36:10 -08:00
local_testing [Staging] - Ishaan March 17th (#23903) 2026-03-18 15:09:01 -07:00
logging_callback_tests Ishaan - March 18th changes (#24056) 2026-03-19 10:20:35 -07:00
mcp_tests [Infra] Merging RC Branch with Main (#23786) 2026-03-16 15:32:20 -07:00
multi_instance_e2e_tests
ocr_tests OCR test fixes 2026-01-11 08:00:31 -08:00
old_proxy_tests/tests remove prompt caching headers as the support has been removed 2026-01-02 11:08:35 +05:30
openai_endpoints_tests Fix flaky e2e batch test: set batch_processed=True on completion in retrieve_batch 2026-03-15 18:18:32 -07:00
otel_tests fix(tests): increase MAX_CALLS and reduce sleep in flaky e2e budget test 2026-03-13 00:04:31 -07:00
pass_through_tests Fix flaky vertex pass-through spend test by polling instead of fixed sleep 2026-03-15 17:37:53 -07:00
pass_through_unit_tests Litellm ishaan march 20 (#24303) 2026-03-21 12:40:11 -07:00
proxy_admin_ui_tests Fix CVEs: bump tar/minimatch/pypdf + harden Docker SBOM patching (#23082) 2026-03-07 18:31:27 -08:00
proxy_e2e_anthropic_messages_tests Merge remote main into litellm_ci_optimize 2026-03-16 00:50:22 -07:00
proxy_e2e_azure_batches_tests Increase file deletion retry budget to 50s for batch_processed race 2026-03-15 15:39:35 -07:00
proxy_security_tests
proxy_unit_tests fix(proxy): sync normalized call_type into model_call_details for proxy-only errors 2026-03-18 23:49:07 +03:00
router_unit_tests Address router generic API review feedback 2026-03-18 15:25:44 -05:00
scim_tests
search_tests Merge remote main, resolve conflict keeping new unit tests 2026-03-09 15:20:20 -07:00
spend_tracking_tests [Staging] - Ishaan March 17th (#23903) 2026-03-18 15:09:01 -07:00
store_model_in_db_tests fix: test mock 2026-01-02 17:38:52 +09:00
test_litellm Litellm ishaan march 20 (#24303) 2026-03-21 12:40:11 -07:00
unified_google_tests Revert "[Infra] Changing Google Tests to use Gemini 3 Flash Preview" 2026-01-20 17:32:10 -08:00
vector_store_tests Add support for vertex ai for rag/ingest 2026-02-13 20:11:10 +05:30
windows_tests
__init__.py
gettysburg.wav
large_text.py
openai_batch_completions.jsonl
README.MD
test_budget_management.py
test_callbacks_on_proxy.py
test_config.py
test_debug_warning.py
test_default_encoding_non_root.py fix: tiktoken cache nonroot offline (#23498) 2026-03-14 10:48:36 -07:00
test_end_users.py
test_entrypoint.py
test_fallbacks.py Revert "fix: prevent error when max_fallbacks exceeds available models (#20071)" 2026-02-03 15:15:30 +05:30
test_gpt5_azure_temperature_support.py [Fix] Remove deprecated o1-preview from O-series test and deduplicate is_o_series check 2026-03-12 13:22:00 -07:00
test_health.py
test_keys.py Adding retries to flaky tests 2026-01-22 15:21:44 -08:00
test_litellm_proxy_responses_config.py
test_logging.conf
test_models.py fix(ci): stabilize CI tests - conditional import, mock fixes, timing adjustments 2026-03-13 00:01:25 +00:00
test_new_vector_store_endpoints.py fix(ci): stabilize CI tests - conditional import, mock fixes, timing adjustments 2026-03-13 00:01:25 +00:00
test_openai_endpoints.py
test_organizations.py Adding retries to flaky tests 2026-01-22 15:21:44 -08:00
test_otel_thread_leak.py Fix thread leak in OpenTelemetry dynamic header path (#19946) 2026-01-28 10:35:37 -08:00
test_passthrough_endpoints.py
test_presidio_latency.py fix(presidio): reuse HTTP connections to prevent OOMs (#19964) 2026-01-28 16:08:53 -08:00
test_proxy_server_non_root.py deactivating non root tests 2026-01-23 22:55:36 -08:00
test_ratelimit.py
test_resource_cleanup.py
test_service_logger_otel.py fix(langfuse_otel): prevent empty proxy request spans from being sent to Langfuse 2026-01-28 15:35:35 +01:00
test_spend_logs.py
test_team.py [Fix] Fail fast when team member spend not flushed in time 2026-03-13 12:40:17 -07:00
test_team_logging.py
test_team_members.py
test_users.py fix(tests): update deprecated Anthropic model in test_user_model_access (#21826) 2026-02-21 14:18:24 -08:00

In total litellm runs 1000+ tests

[02/20/2025] Update:

To make it easier to contribute and map what behavior is tested,

we've started mapping the litellm directory in tests/test_litellm

This folder can only run mock tests.