ci: skip live tests on 429 (shared-key rate-limit resilience)#38
Conversation
The integration/live tests hit the real API with a single 1-request/second key that is shared across SDK repos in CI. Cross-repo contention produces HTTP 429 (RateLimitError) responses that fail otherwise-green code. Add a `live_call` fixture in tests/integration/conftest.py that: - spaces live calls >= 1.1s apart (1 req/sec shared key), and - converts any 429 (RateLimitError) into a pytest.skip while re-raising all other errors unchanged so real failures still surface. Route every live API call in test_live_api.py and test_historical_endpoints.py through this helper. The existing skip-if-no-OILPRICEAPI_KEY behavior is preserved. No version bump. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 56 minutes and 11 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The integration/live tests hit the real API with a single 1-request/second key that is shared across SDK repos in CI. Cross-repo contention produces HTTP 429 (RateLimitError) responses that fail otherwise-green code. Add a `live_call` fixture in tests/integration/conftest.py that: - spaces live calls >= 1.1s apart (1 req/sec shared key), and - converts any 429 (RateLimitError) into a pytest.skip while re-raising all other errors unchanged so real failures still surface. Route every live API call in test_live_api.py and test_historical_endpoints.py through this helper. The existing skip-if-no-OILPRICEAPI_KEY behavior is preserved. No version bump. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Problem
The live/integration tests hit the real API with a single 1-request/second key shared across SDK repos in CI. Cross-repo contention produces HTTP 429 (
RateLimitError) responses that red-flag otherwise-green code.Change
Add a
live_callfixture intests/integration/conftest.pythat:RateLimitError) into apytest.skip("rate-limited (shared CI key) - skipping live assertion").pytest.skipraisesSkipped, aBaseException, so it also propagates correctly past the timeout test'sexcept Exception).Every live API call in
test_live_api.pyandtest_historical_endpoints.pyis routed through this helper. The concurrent stress test wraps itsfuture.result()collection in the same 429->skip guard.Preserved behavior
OILPRICEAPI_KEYbehavior is unchanged.oilpriceapi/) changes — tests only.Gates (all green locally)
mypy oilpriceapi/ --ignore-missing-imports-> Successruff check oilpriceapi/-> All checks passedpytest tests/ --ignore=tests/integration --ignore=tests/contract -m 'not slow' --cov=oilpriceapi-> 311 passed, 9 skipped, coverage 59.33% (>50%)🤖 Generated with Claude Code