litellm/tests/test_litellm/proxy/db
ryan-crabbe-berri 680bcfd8aa
test(lint): ban blind pytest.raises(Exception) with ruff B017 (#37731)
* test(lint): ban blind pytest.raises(Exception) with ruff B017

A bare pytest.raises(Exception) accepts whatever the body throws. The TypeError
a refactor introduces satisfies it exactly as well as the rejection the test was
written for, so the crash reads as a pass and the test never goes red.

All 111 existing sites are narrowed here. A runtime probe recorded the concrete
exception each one actually catches, and each site now names that type. Where
the code under test genuinely raises a bare Exception, the site pins a stable
slice of the message with match= instead.

Two sites tell on themselves. The shared responses-API cancel test raises
"custom_llm_provider is required but passed as None" rather than talking to a
provider at all, because cancel_responses takes a provider, not a model. And
test_bedrock_guardrails_with_streaming was the only test in its file still
passing without AWS credentials, because the NoCredentialsError boto3 raised
long before the guardrail ran satisfied the blind raises.

* fix(test): widen the openai batch-dispatch assertion to OpenAIError

The narrowed NotFoundError only holds where OPENAI_API_KEY is set. Without one
the SDK raises OpenAIError while building the client, long before any 404, so CI
went red. OpenAIError covers both and still rejects a TypeError from a refactor.
2026-08-20 18:09:42 -07:00
..
db_transaction_queue Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_fix_redis_spend_buffer_requeue_33872 2026-08-14 19:07:19 +00:00
mcp_server test: add six ruff rules that catch tests which cannot fail (#37709) 2026-08-20 14:21:26 -07:00
conftest.py feat(proxy): authenticate to Azure Postgres with Microsoft Entra ID tokens 2026-08-20 11:50:16 -07:00
test_autorouter_session_rollup.py feat: pre-adoption shadow eval for the auto-router (blind pairwise judge, derived state) (#36587) 2026-08-13 13:15:45 -07:00
test_check_migration.py build: migrate packaging, CI, and Docker from Poetry to uv (#25007) 2026-04-09 11:46:23 -07:00
test_create_views.py fix(proxy): guard every view creation, not just the first and last 2026-08-13 14:41:59 -07:00
test_daily_spend_bulk_upsert.py perf(spend): write each daily spend batch in one upsert statement (#36448) 2026-08-10 17:06:00 -07:00
test_db_spend_update_writer.py Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_fix_spend_deadlock_retry 2026-08-19 14:55:58 -07:00
test_db_url_settings.py fix(db): apply the configured connection params to the read replica URL (#37691) 2026-08-20 17:23:06 -07:00
test_exception_handler.py fix(jwt): retry JWKS fetches, serve stale keys, and return 503 when the IdP is unreachable (#37690) 2026-08-20 16:41:06 -07:00
test_exception_handler_reconnect_retry.py fix(reset_budget_job): reconnect and retry on transient DB transport errors (#37705) 2026-08-20 16:02:51 -07:00
test_gateway_request_tracking.py feat(sgr): make the gateway middleware the source of truth for successful requests (#35717) 2026-08-05 12:40:47 -07:00
test_prisma_client.py fix(proxy): keep token-auth URLs, toggles, and refresh sleeps safe 2026-08-20 12:59:58 -07:00
test_prisma_planned_engine_restart.py fix(proxy): stop alerting on health probes that lose the planned engine-restart race (#36141) 2026-08-07 09:57:30 -07:00
test_prisma_self_heal.py test(lint): ban blind pytest.raises(Exception) with ruff B017 (#37731) 2026-08-20 18:09:42 -07:00
test_proxy_worker_heartbeat.py fix(proxy): count worker heartbeats on the primary so replica lag cannot undercount 2026-08-14 17:23:06 -07:00
test_query_engine_reaper.py fix(proxy_cli): reap orphaned prisma query-engine processes when a worker dies (#33424) 2026-07-16 13:16:41 -07:00
test_rds_iam_token_expiry.py fix(tests): stop DATABASE_URL env pollution from read-replica tests breaking DB e2e tests (#32653) 2026-07-09 14:37:49 -07:00
test_replica_identity.py feat(db): opt-in REPLICA IDENTITY FULL after prisma migrations (#35267) 2026-07-30 15:45:40 -07:00
test_routing_prisma_wrapper.py feat(proxy): authenticate to Azure Postgres with Microsoft Entra ID tokens 2026-08-20 11:50:16 -07:00
test_spend_log_batching.py fix(proxy): requeue spend logs when the DB write fails with a transport error (#36716) 2026-08-14 20:49:45 -07:00
test_spend_log_tool_index.py fix(proxy): close the adversarial-review findings on the tool spend rollup 2026-07-26 01:55:47 -07:00
test_token_auth.py fix(proxy): keep token-auth URLs, toggles, and refresh sleeps safe 2026-08-20 12:59:58 -07:00
test_tool_registry_writer.py fix(proxy): self-heal startup/reload prisma reads on engine disconnect (#28803) 2026-06-10 20:16:58 +02:00