Repository navigation
wait_chain: call strategies positionally, accept WaitBaseT - #783
Open
tony1233200 wants to merge 1 commit into
Open
tony1233200 wants to merge 1 commit into
tony1233200 wants to merge 1 commit into
Conversation
wait_chain passed retry_state as a keyword argument, so any plain callable wait strategy whose parameter is not named retry_state raised TypeError. Call it positionally, as wait_combine does, widen the constructor to WaitBaseT, and add a regression test (fixes jd#780).
Contributor
|
Tick the box to add this pull request to the merge queue (same as
|
This branch has not been deployed
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.
Fixes #780.
wait_chain.__call__passedretry_stateas a keyword argument, so any plain callable wait strategy whose parameter is not namedretry_stateraisedTypeError.wait_combine(andwait_fixed(0) + callable) already call the strategy positionally, sowait_chainwas the odd one out.wait_chain.__call__, with the same rationale comment aswait_combine.wait_chain.__init__from*strategies: wait_baseto*strategies: WaitBaseT, likewait_combine.test_wait_chain_passes_state_positionally(alambda rs: ...strategy as the second chain element).Verified: the issue reproduction now retries through
my_waitinstead of raisingTypeError;tests/test_tenacity.py143 passed, plustest_after/test_utils/test_issue_4787 passed;ruff checkandruff format --checkclean.