Skip to content

test(litellm): Replace mocks with httpx types in rate-limit test#5975

Open
alexander-alderman-webb wants to merge 6 commits intowebb/litellm/embedding-testsfrom
webb/litellm/rate-limit-mock
Open

test(litellm): Replace mocks with httpx types in rate-limit test#5975
alexander-alderman-webb wants to merge 6 commits intowebb/litellm/embedding-testsfrom
webb/litellm/rate-limit-mock

Conversation

@alexander-alderman-webb
Copy link
Copy Markdown
Contributor

@alexander-alderman-webb alexander-alderman-webb commented Apr 10, 2026

Description

Replace mocks with httpx types to avoid test failures when library internals change.

Issues

Reminders

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (ai) Redact base64 data URLs in image_url content blocks by ericapisani in #5953
  • (integrations) Instrument pyreqwest tracing by servusdei2018 in #5682
  • (litellm) Add async callbacks by alexander-alderman-webb in #5969

Bug Fixes 🐛

Anthropic

  • Capture exceptions for stream() calls by alexander-alderman-webb in #5950
  • Stop setting transaction status when child span fails by alexander-alderman-webb in #5717
  • Only finish relevant spans in .create() patches by alexander-alderman-webb in #5716

Other

  • (litellm) Avoid double span exits when streaming by alexander-alderman-webb in #5933
  • (pydantic-ai) Use first-class hooks when available by alexander-alderman-webb in #5947
  • (wsgi) Respect HTTP_X_FORWARDED_PROTO in request.url construction by sl0thentr0py in #5963

Internal Changes 🔧

Litellm

  • Replace mocks with httpx types in rate-limit test by alexander-alderman-webb in #5975
  • Replace mocks with httpx types in embedding tests by alexander-alderman-webb in #5970
  • Replace mocks with httpx types in nonstreaming completion() tests by alexander-alderman-webb in #5937

Other

  • (ai) Remove gen_ai.tool.type span attribute by ericapisani in #5964
  • (anthropic) Separate sync and async .create() patches by alexander-alderman-webb in #5715
  • (openai) Split token counting by API for easier deprecation by ericapisani in #5930
  • (opentelemetry) Ignore mypy error by alexander-alderman-webb in #5927
  • Fix license metadata in setup.py by sl0thentr0py in #5934
  • Update validate-pr workflow by stephanie-anderson in #5931

Other

  • Handle None span context in the span processor and pin tokenizers version for anthropic tests on Python 3.8 by alexander-alderman-webb in #5967

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

Codecov Results 📊

13 passed | Total: 13 | Pass Rate: 100% | Execution Time: 6.14s

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 14911 uncovered lines.


Generated by Codecov Action

@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review April 10, 2026 14:01
@alexander-alderman-webb alexander-alderman-webb requested a review from a team as a code owner April 10, 2026 14:01
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 179f14b. Configure here.

"model": "gpt-3.5-turbo",
"messages": messages,
}
client = OpenAI(api_key="z")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenAI client retries 429 causing unnecessary test delay

Low Severity

OpenAI(api_key="z") uses the default max_retries=2, so when the mock returns a 429 response, the OpenAI client will automatically retry twice with exponential backoff (~1.5 seconds of sleeping) before finally raising RateLimitError. The old test called _failure_callback directly and had no such delay. Creating the client with max_retries=0 would avoid unnecessary retries and keep the test fast.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 179f14b. Configure here.

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