litellm/tests/code_coverage_tests
yuneng-jiang da55893656
ci(unit): cut unit check time with cheaper per-test resets and fewer non-unit tests (#51864)
* test(unit): reset module state only when a test changed it

The proxy conftest deep-copied every snapshotted litellm attribute before each
test, and the copy of litellm.model_cost alone was a median 0.12 s for each of
56,031 proxy tests on the runner. The reset now copies an attribute back only
when it no longer equals the snapshot.

The enterprise and MCP server conftests reloaded litellm before every test,
3.27 s and 0.21 s per test. They now use the same reset.

* test(unit): remove six flaky tests

They failed on main without a code change behind them between 2026-11-05 and
2026-11-14: the vector store hook SDK fallback, the concurrent user config TPM
count, three Prometheus metrics server port tests and the OpenCode list cost
billing test.

* ci: run four heavy unit shards on 16-core runners and keep two smoke jobs off pull requests

proxy-feature-endpoints, proxy-endpoints, root and llms-providers ran 1.9 to 2.2
times faster with 8 workers on a 16-core runner in a benchmark run.

windows-sdk and proxy-build-from-pip still run on pushes to main and manual
runs. proxy-build-from-pip installs a published release and never runs the
pull request's code.

* test: move 109 tests that start a process or open a socket into tests/integration

tests/unit is in-process by its own rules, and these tests spawn a Python
interpreter, a shell or a local TCP or HTTP server. They took 921 s of unit
shard time per run, 396 s of it in the MCP client transport tests. Each one now
lives in a *_real_io.py file under the integration directory for its domain and
runs with that directory's group.

The tests themselves are unchanged apart from one repository-root path in the
CLI test.

* test(unit): copy back only the dict entries a test changed

A test module that registers models at import leaves litellm.model_cost four
entries larger than the snapshot before every test in its directory, so the
reset still deep-copied the whole price map for each of them. It now rebuilds a
changed dict from the live entries that still match and copies only the rest.

* ci(smoke): keep the two jobs that skip on pull requests out of the smoke gate

A skipped job passing the gate is what test_unit_passed_gate guards against,
so the gate goes back to requiring success from every job it needs and
windows-sdk and proxy-build-from-pip stop being part of it. They still run
and report on pushes to main and manual runs.
2026-11-14 15:41:30 -08:00
..
azure_client_usage_test.py
ban_constant_numbers.py
ban_copy_deepcopy_kwargs.py
bedrock_pricing.py
callback_manager_test.py
check_data_replace_usage.py
check_e2e_no_raw_requests.py
check_endpoint_coverage.py
check_fastuuid_usage.py
check_get_model_cost_key_performance.py
check_guardrail_apply_decorator.py
check_licenses.py
check_migrations_lock_timeout.py
check_migrations_no_data_rewrites.py
check_no_none_string_error_fields.py
check_no_publicly_known_master_key.py
check_prisma_binary_cache.py
check_provider_folders_documented.py
check_py310_typing_imports.py
check_spanattributes_value_usage.py
check_telemetry_imports.py
check_unbounded_in_lists.py
check_unsafe_enterprise_import.py
check_workflow_job_name_collisions.py
check_workflow_startup_safety.py
code_qa_check_tests.py
dependency_license_cache.json
enforce_llms_folder_style.py
ensure_async_clients_test.py
info_log_check.py
liccheck.ini
license_cache.json
litellm_logging_code_coverage.py
log.txt
memory_test.py
prevent_key_leaks_in_exceptions.py
recursive_detector.py fix(bedrock): map OpenAI vector store search filters to AWS RetrievalFilter (#51291) 2026-11-14 13:39:43 -05:00
router_code_coverage.py
router_enforce_line_length.py
router_litellm_globals_check.py
router_surface_allowlist.json
router_surface_check.py
test_aio_http_image_conversion.py
test_ban_set_verbose.py
test_chat_completion_imports.py
test_check_no_none_string_error_fields.py
test_check_no_publicly_known_master_key.py
test_e2e_idp_stack.py
test_e2e_junit_report.py
test_e2e_metadata.py
test_generate_provider_endpoints_support.py
test_merge_smoke.py
test_no_hardcoded_secrets.py
test_provider_cache.py
test_provider_replay_harness.py
test_proxy_types_import.py
test_router_strategy_async.py
test_unit_passed_gate.py ci(unit): cut unit check time with cheaper per-test resets and fewer non-unit tests (#51864) 2026-11-14 15:41:30 -08:00
test_workflow_job_name_collisions.py
unbounded_in_baseline.txt feat(proxy): customer budget rollup, reset on the budget row's window, named templates, team overrides, multi-window limits and pause_allow_increase (#51582) 2026-11-13 16:05:35 +00:00