litellm - 💡(How to fix) Fix [Bug]: CI test fails due to `test_check_responses_cost.py` mismatch with the latest commit [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#25279Fetched 2026-04-08 03:02:17
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
labeled ×2

Root Cause

Consequently, the CI test Proxy Legacy Tests / auth-and-jwt (pull_request) is consistently failing. The failures are occurring because:

  1. mock_prisma_client.db.litellm_managedobjecttable.update_many is configured as a MagicMock instead of an AsyncMock.
  2. When check_responses_cost() attempts to await the stale cleanup call, it fails.
  3. The cleanup process does not complete properly, leading to assertion failures where the tests expect two update_many calls but only receive one.
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

In this latest commit (7a9a9f0), _cleanup_stale_managed_objects was changed to use execute_raw instead of update_many, but the corresponding test file was not updated.

Consequently, the CI test Proxy Legacy Tests / auth-and-jwt (pull_request) is consistently failing. The failures are occurring because:

  1. mock_prisma_client.db.litellm_managedobjecttable.update_many is configured as a MagicMock instead of an AsyncMock.
  2. When check_responses_cost() attempts to await the stale cleanup call, it fails.
  3. The cleanup process does not complete properly, leading to assertion failures where the tests expect two update_many calls but only receive one.

Steps to Reproduce

  1. submit a PR
  2. wait for the test failed

Relevant log output

What part of LiteLLM is this about?

Proxy

What LiteLLM version are you on ?

v1.83.3

Twitter / LinkedIn details

No response

extent analysis

TL;DR

Update the test file to use AsyncMock instead of MagicMock for mock_prisma_client.db.litellm_managedobjecttable.update_many to fix the CI test failure.

Guidance

  • Identify the specific test file that needs to be updated, likely related to Proxy Legacy Tests / auth-and-jwt (pull_request).
  • Update the mock_prisma_client.db.litellm_managedobjecttable.update_many configuration to use AsyncMock to match the asynchronous nature of the _cleanup_stale_managed_objects function.
  • Verify that the test failure is resolved by checking the CI test results after updating the test file.
  • Review the test file to ensure that it correctly handles the asynchronous cleanup process and updates the assertions accordingly.

Example

from unittest.mock import AsyncMock

# Update the mock configuration to use AsyncMock
mock_prisma_client.db.litellm_managedobjecttable.update_many = AsyncMock()

Notes

The fix assumes that the issue is solely due to the mismatch between the synchronous MagicMock and the asynchronous execute_raw function. If other factors contribute to the test failure, additional updates may be necessary.

Recommendation

Apply workaround: Update the test file to use AsyncMock as described, to resolve the CI test failure.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

litellm - 💡(How to fix) Fix [Bug]: CI test fails due to `test_check_responses_cost.py` mismatch with the latest commit [1 participants]