Repository navigation
Add unit tests for apple and play with_retry - #21
Merged
Merged
Conversation
Covers retry-then-succeed, giving up after the attempt limit, the Play 4xx/5xx distinction, and the 2, 4, 8, 16 backoff, with time.sleep patched.
2 tasks
FidelisMM
approved these changes
Oct 2, 2026
FidelisMM
left a comment
Owner
There was a problem hiding this comment.
Thanks a lot @CodeByPeace, and that was fast! This covers everything #19 asked for, for both stores: transient failures, giving up after tentativas (Apple wrapping in AppleError with the cause kept, Play re-raising the original), 5xx vs 4xx PlayError, and the 2/4/8/16 backoff. The Flaky helper keeps every test readable. I also flipped the " HTTP 5" check locally and the suite caught it, same as you did. 22/22 pass, ruff clean, CI green. Merging now.
FidelisMM
added a commit
that referenced
this pull request
Oct 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #19
What
Adds
tests/test_retry.pywith unit tests forwith_retryin bothapple.pyandplay.py.time.sleepis patched, so the tests run instantly, and a small fake function fails a set number of times before succeeding.Apple:
httpx.HTTPStatusErrortentativasattempts and raisesAppleErrorwith the original error as the causePlay:
httpx.TransportErrorafter the last attemptPlayErrorcontaining " HTTP 5", and re-raises it after the last attemptPlayError(one call, no sleep)Both: the backoff waits 2, 4, 8, 16 seconds with the default 5 attempts.
I also temporarily changed the " HTTP 5" check in
play.pyand confirmed the new tests fail, then restored it. No source files are changed.Tested against
Ran the three CI checks locally: ruff, the unit tests (22 pass), and the compile check.
Checklist
AI use: I used Claude Sonnet 5.5 to help write the tests. I ran them, checked them by breaking the Play 5xx check, and reviewed the final code myself.