Repository navigation
fix(wait): call wait_chain strategies positionally - #781
Omarinho12345 wants to merge 1 commit into
Conversation
A plain callable is a valid wait strategy for wait=, wait_combine() and wait_fixed() + callable, all of which pass the state positionally. wait_chain() passed etry_state by keyword, so it raised TypeError on any callable whose parameter is not named etry_state. Fixes jd#780
|
Tick the box to add this pull request to the merge queue (same as
|
Ekko82
left a comment
There was a problem hiding this comment.
I ran four focused cases on Windows x64 with CPython 3.13.9 using the default sleepers and zero delays. With a positional-only callable as the final wait_chain strategy, both Retrying and AsyncRetrying raised TypeError after attempt 2 on the base because the chain passed retry_state by keyword. On 4264fa5, both returned the result on attempt 4. The callable received the failure state for attempts 2 and 3, exercising reuse of the final strategy.
The equivalent wait_fixed controls passed on both revisions. I ran these cases outside the full test suite.
Problem
wait_chain()called the selected wait strategy aswait_func(retry_state=retry_state). A plain callable is a validWaitBaseTwait strategy everywhere else —wait=,wait_combine(),wait_fixed() + callable,sum([...])— and those paths pass the state positionally, so a callable whose parameter is not named exactlyretry_stateworked in all of them but raisedTypeErrorinsidewait_chain():The same callable works with
wait_combine(wait_fixed(0), ...)andwait_fixed(0) + ....Fix
wait_combineandBaseRetrying._run_wait.wait_chain.__init__to*strategies: WaitBaseTso the signature reflects what is actually supported.test_wait_chain_accepts_callable_strategy, which fails on current main and passes with the change.No behaviour change for
wait_basesubclasses, which accept the state as a keyword.Tests
Fixes #780