litellm/tests/vector_store_tests
yuneng-jiang de1bc29dc7
test: unshadow the module handles the F811 sweep left behind (#37914)
* test: unshadow the module handles the F811 sweep left behind, and pin the two live tests that went red with it

The F811 sweep in #37878 removed the fixture-local `import litellm` from four
conftests, but the bare `import litellm.proxy.proxy_server` a few lines below
still binds `litellm` as a function local, so `importlib.reload(litellm)` runs
before the name is assigned and every test in those directories errors at
setup. The `hasattr` guard on the line above already proves the module is
loaded, so the import only ever bound the name. Drop it, and enable F823 in
ruff-tests.toml, which flags all four sites at the failing line and would have
blocked the sweep

The same sweep renamed the `check_non_streaming_response` parameter but left
one read of `completion`, which now resolves to `litellm.completion`, and
removed an import whose side effect was the only thing making
`litellm.proxy.proxy_server` reachable in the moderation hook test. That test
already takes `monkeypatch`, so patch the router through it and stop leaking
the router into later tests

`test_content_policy_exception_openai` passed vacuously until #37887 turned it
into a real `pytest.raises`, and OpenAI no longer rejects a lyrics prompt with
a content policy error. Inject an AsyncOpenAI client whose transport answers
with OpenAI's own `content_policy_violation` rejection so the mapping to
ContentPolicyViolationError is exercised every run

`test_async_create_batch` hit a 409 cancelling a batch OpenAI had already
marked failed. The cancel step tolerated a completed batch but not a failed
one. Fold both guards into one helper that tolerates a failed batch only when
OpenAI's recorded error is the org's enqueued token limit, and prints the
batch's errors so the reason is in the log either way

* test: close the injected AsyncOpenAI client after the content policy test

* chore(lint): ratchet TQ005 down by the global mutation this branch cleared

* chore(lint): ratchet TQ005 to 2660 on the merged tree

* chore(lint): ratchet TQ005 to 2561 on the merged tree

* chore(lint): ratchet TQ005 to 2548 on the merged tree
2026-08-22 16:16:38 +00:00
..
rag style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
base_vector_store_test.py test: enforce F811 so a duplicate definition cannot silently replace the first 2026-08-21 12:06:19 -07:00
conftest.py test: unshadow the module handles the F811 sweep left behind (#37914) 2026-08-22 16:16:38 +00:00
test_azure_ai_vector_store.py test: update test apis 2026-03-28 18:57:27 -07:00
test_azure_vector_store.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_bedrock_vector_store.py Revert "chore(tests): migrate Bedrock CI to AWS account 941277531214 (#28728)" (#29326) 2026-05-30 11:26:24 -07:00
test_gemini_vector_store.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_milvus_vector_store.py fix: drop milvus dbName and partitionNames from MILVUS_OPTIONAL_PARAMS 2026-04-30 11:51:32 -07:00
test_openai_vector_store.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_ragflow_vector_store.py test(lint): ban blind pytest.raises(Exception) with ruff B017 (#37731) 2026-08-20 18:09:42 -07:00
test_s3_vectors_vector_store.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_vertex_ai_search_api_vector_store.py (feat) Vector Stores: support Vertex AI Search API as vector store through LiteLLM (#15781) 2025-10-22 18:56:36 -07:00
test_vertex_ai_vector_store.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00