Match only_rerun against wrapped exception causes - #364
Open
teddytennant wants to merge 1 commit into
Open
Conversation
Wrapped errors such as raise RuntimeError(...) from MemoryError(...) were matched on the outer type and message only, so --only-rerun MemoryError did not retry them.
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 #353.
--only-rerun/only_rerun(and--rerun-except) match the outermost exception only. A transient error wrapped withraise ... fromis not retried, even when the inner type is exactly what the filter is for.The same test without the wrapper reruns as expected.
_try_match_errorbuilt the match string fromexcinfo.type/excinfo.valueand never walked__cause__or__context__.The matcher now walks that chain (skipping a context suppressed by
raise ... from None) and treats a hit on any linked exception as a match. Existing outer-exception matches are unchanged.Regression tests cover a
__cause__wrap, an implicit__context__wrap, the exception-class form ofonly_rerun,rerun_excepton a wrapped error, a suppressed context, and a non-matching control.