Skip to content

test(errors): add RateLimitError coverage (Closes #19)#28

Merged
codebestia merged 1 commit into
ShadeProtocol:mainfrom
Rachaelisa:fix/19-implement-ratelimit-error
Jun 26, 2026
Merged

test(errors): add RateLimitError coverage (Closes #19)#28
codebestia merged 1 commit into
ShadeProtocol:mainfrom
Rachaelisa:fix/19-implement-ratelimit-error

Conversation

@Rachaelisa

@Rachaelisa Rachaelisa commented Jun 25, 2026

Copy link
Copy Markdown

Summary

Closes #19

RateLimitError was already implemented on main via PR #24 (errors.py, http.py, and tests/test_rate_limit.py). This PR adds complementary coverage in tests/test_errors.py to verify:

  • RateLimitError inherits from ShadeError
  • retry_after is set from the Retry-After header value (or None when absent)
  • RateLimitError is exported from the package root

Acceptance criteria verification

Criteria Status Where
HTTP 429 raises RateLimitError src/shade/http.py (_raise_for_status)
error.retry_after reflects Retry-After header tests/test_rate_limit.py
retry_after is None when header absent tests/test_rate_limit.py, tests/test_errors.py

Test plan

  • poetry run pytest -v — 35/35 passed

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling for rate limit errors, including retry timing information when available.
    • Ensured the rate limit error is available from the package root for consistent access.
  • Tests

    • Added coverage for rate limit error behavior with and without a retry-after value.

Extend the error test suite to verify RateLimitError inherits from
ShadeError, exposes retry_after, and is exported from the package root.

Closes ShadeProtocol#19
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bec3f168-1c95-4ddc-84e3-88f6121b9e70

📥 Commits

Reviewing files that changed from the base of the PR and between f6a4cff and 85e8210.

📒 Files selected for processing (1)
  • tests/test_errors.py

📝 Walkthrough

Walkthrough

Adds RateLimitError coverage in tests/test_errors.py for inheritance, package export, and retry_after handling.

Changes

RateLimitError test coverage

Layer / File(s) Summary
Error class coverage
tests/test_errors.py
Adds RateLimitError to the imported error classes, the ShadeError subclass coverage set, and the package-root export assertion.
retry_after handling
tests/test_errors.py
Adds tests that verify RateLimitError.retry_after is set from the provided value and remains None when omitted, with the expected status code.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • codebestia

Poem

A bunny hopped by, ears held high,
To greet RateLimitError in the sky.
With retry_after in its cozy pocket,
It waits just right, like a ticking rocket.
Hop, hop — the tests all sing today 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly names the main change: added RateLimitError test coverage tied to issue #19.
Description check ✅ Passed The description includes summary, issue reference, context, acceptance criteria, and test results; only non-critical template sections are omitted.
Linked Issues check ✅ Passed The PR adds the requested RateLimitError coverage and verifies retry_after/export behavior, matching the linked issue's remaining acceptance criteria.
Out of Scope Changes check ✅ Passed The only changes are focused test updates for RateLimitError, with no unrelated code or scope creep.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@Rachaelisa Rachaelisa closed this Jun 25, 2026
@Rachaelisa Rachaelisa reopened this Jun 25, 2026

@codebestia codebestia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!
Thank you for your contribution.

@codebestia codebestia merged commit b1a883e into ShadeProtocol:main Jun 26, 2026
2 checks passed
@grantfox-oss grantfox-oss Bot mentioned this pull request Jun 26, 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.

Implement RateLimitError

3 participants