Commit Graph

4 Commits

Author SHA1 Message Date
Mateo Wang c1602587c1 fix(tests): drop module-level test calls that break local_testing collection (#29520)
* fix(tests): drop module-level test calls that break local_testing collection

Several files in tests/local_testing invoked their test functions at module
scope (e.g. test_register_model.py ran test_update_model_cost_via_completion()
at the bottom of the file). Those calls execute during pytest collection, so
they fire real network requests at import time. test_register_model.py's call
hit an OpenAI 429 and raised, turning into a collection error.

A collection error aborts the whole session for every job that globs
tests/local_testing/**/test_*.py, which is why unrelated jobs like
langfuse_logging_unit_tests (-k langfuse) and litellm_assistants_api_testing
(-k assistants) both failed even though neither touches register_model;
the -k filter only applies after collection.

pytest discovers and runs these test_* functions on its own, so the top-level
calls were dead and harmful. Removes them from test_register_model.py,
test_wandb.py, test_lunary.py, and test_multiple_deployments.py, and adds a
regression test that scans the directory for module-level test invocations.

* test(local_testing): skip unparseable files in module-scope invocation guardrail

A syntax error in any tests/local_testing file would make ast.parse raise an
unhandled SyntaxError, so the guardrail itself would crash with a confusing
traceback instead of its assertion message. Such a file already fails pytest
collection on its own, which is the clearer signal, so the guardrail now skips
files it cannot parse and stays focused on detecting module-scope test calls.
Reads files as utf-8 for deterministic behavior across platforms.
2026-06-02 13:07:05 -07:00
Yuneng Jiang 95e1babf67 [Fix] TogetherAIConfig.get_supported_openai_params recursion
TogetherAIConfig.get_supported_openai_params called get_model_info(),
whose first line calls litellm.get_supported_openai_params() — which for
together_ai routes straight back into this method. The recursion only
terminated when Python's recursion limit was hit or when
_get_model_info_helper raised "not mapped" at the deepest level. Either
way the try/except caught it, so the bug stayed silent — but the cycle
ran ~332 deep every time, emitting hundreds of DEBUG log lines per
call. Surfaced as "infinite loop" in CI when the success_handler thread
emitted that log spam against an already-closed stderr during test
teardown.

Replace the get_model_info() call with supports_function_calling(),
which uses _get_model_info_helper directly and does not call
get_supported_openai_params. Measured drop from 332 to 2
_get_model_info_helper calls per first uncached lookup.

Also swap the test model from Qwen/Qwen3.5-9B (not in model_cost map)
back to a mapped serverless model, Qwen/Qwen2.5-7B-Instruct-Turbo. The
mapping gap is what made the recursion's tail end raise up into the
success handler during teardown in the first place.
2026-04-16 17:20:58 -07:00
Yuneng Jiang a9c6156137 [Fix] Test - Together AI: replace deprecated Mixtral with serverless Qwen3.5-9B
Mixtral-8x7B-Instruct-v0.1 is no longer on Together AI's serverless tier
and now requires a dedicated endpoint, causing multiple tests to fail in CI:

  - test_together_ai.py::TestTogetherAI::test_empty_tools
  - test_completion.py::test_completion_together_ai_stream
  - test_completion.py::test_customprompt_together_ai
  - test_completion.py::test_completion_custom_provider_model_name
  - test_text_completion.py::test_async_text_completion_together_ai

Qwen/Qwen3.5-9B is currently serverless on Together AI and supports
function calling, satisfying BaseLLMChatTest capability requirements.
2026-04-14 17:43:35 -07:00
Krrish Dholakia 3560f0ef2c refactor: move all testing to top-level of repo
Closes https://github.com/BerriAI/litellm/issues/486
2024-09-28 21:08:14 -07:00