assertion/rewrite: fix test crash on assert failure with terminalreporter disabled#14418
Open
bluetech wants to merge 5 commits intopytest-dev:mainfrom
Open
assertion/rewrite: fix test crash on assert failure with terminalreporter disabled#14418bluetech wants to merge 5 commits intopytest-dev:mainfrom
terminalreporter disabled#14418bluetech wants to merge 5 commits intopytest-dev:mainfrom
Conversation
Change `Any`s to `object`. It's better to use `object` for "unknown" -- `object` is type safe, `Any` is not. To aid in this, change the `is*` functions to TypeGuards, so their check is carried over to the typing. Since pytest already uses dataclasses extensively internally, I removed the lazy import of it, this way can more easily utilize the existing type guard from typeshed.
…rox` is on the LHS
Seems better to make the lower-level function more agnostic.
…orter` disabled The `config.get_terminal_writer()` in `assertrepr_compare` (=> the function injected by assertion rewriting for every `assert`) requires the `terminalreporter` plugin, so it crashed when the plugin is disabled. Fix pytest-dev#14377.
d84e6e3 to
54f8638
Compare
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.
Based on #14383. Replaces #14378 (see there for some context).
The
config.get_terminal_writer()inassertrepr_compare(=> the function injected by assertion rewriting for everyassert) requires theterminalreporterplugin, so it crashed when the plugin is disabled.Fix #14377.