Skip to content

test(litellm): make tool-call argument log tests independent of test order - #7461

Closed
ankit2235 wants to merge 1 commit into
google:mainfrom
ankit2235:fix/litellm-debug-log-capture
Closed

ankit2235 wants to merge 1 commit into
google:mainfrom
ankit2235:fix/litellm-debug-log-capture

Conversation

@ankit2235

Copy link
Copy Markdown

Link to Issue or Description of Change

2. Or, if no issue exists, describe the change:

Problem:
Four tests in TestParseToolCallArguments (tests/unittests/models/test_litellm.py) fail depending on test order:

  • test_repaired_arguments_log_debug_with_raw_payload
  • test_repaired_arguments_without_function_name
  • test_literal_eval_layer_logs_debug_not_warning
  • test_literal_eval_without_function_name_logs_debug

They use caplog.at_level(logging.DEBUG), which only lowers the root logger. CLI tests call setup_adk_logger(), which sets the google_adk logger to INFO and leaves it there. When a CLI test runs earlier in the same process, logger.isEnabledFor(logging.DEBUG) in lite_llm.py is False, the DEBUG branch is skipped, and the assertions on the raw payload fail.

Reproduce on main:

pytest tests/unittests/cli tests/unittests/models/test_litellm.py::TestParseToolCallArguments -q
4 failed, 1448 passed, 5 skipped, 3 xfailed

Solution:
Set the level on the google_adk logger explicitly: caplog.at_level(logging.DEBUG, logger="google_adk"). This matches the fix already used elsewhere in the same file. Test-only change; no library code is modified.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.
# Order-dependent reproduction, after the fix
pytest tests/unittests/cli tests/unittests/models/test_litellm.py::TestParseToolCallArguments -q
1452 passed, 5 skipped, 3 xfailed

# Whole file
pytest tests/unittests/models/test_litellm.py -q
566 passed

Note: on a full local run, test_gke_code_executor.py fails with kubernetes 37.0.0. That is unrelated to this change and tracked in #7443.

Manual End-to-End (E2E) Tests:

Not applicable: test-only change.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

…order

TestParseToolCallArguments lowered only the root logger with
caplog.at_level(logging.DEBUG). When a CLI test runs earlier in the same
process, setup_adk_logger() leaves the "google_adk" logger at INFO, so
lite_llm skips its DEBUG branch and four tests fail depending on test order.

Set the level on the "google_adk" logger explicitly, as is already done
elsewhere in this file.
@ankit2235 ankit2235 changed the title test(litellm): make tool-call argument log tests independent of test … test(litellm): make tool-call argument log tests independent of test order Oct 8, 2026
@ankit2235

Copy link
Copy Markdown
Author

This was fixed on main in eb53675, which scopes the same caplog calls (and the WARNING ones in this class) to the google_adk logger, so I'm closing this one. Thanks!

@ankit2235 ankit2235 closed this Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants