fix: keep frame locations in longrepr under --tb=line/no#14729
Closed
l46983284-cpu wants to merge 1 commit into
Closed
fix: keep frame locations in longrepr under --tb=line/no#14729l46983284-cpu wants to merge 1 commit into
l46983284-cpu wants to merge 1 commit into
Conversation
Compact traceback styles used to drop ReprEntry.reprfileloc, so plugins that suppress terminal output with --tb=no lost all file/line metadata while still seeing empty anonymous entries. Always attach ReprFileLocation for compact styles; only terminal rendering stays compact (no per-frame dump for line/no). Fixes pytest-dev#14720 Signed-off-by: Alex Chen <l46983284@gmail.com>
Author
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.
Summary
--tb=lineand--tb=noused to build compactlongreprentries withoutreprfileloc. Plugins that suppress pytest's own traceback via--tb=nostill sawreprentries, but every frame's file/line wasNone, so custom reporters silently lost location data.This keeps structural frame locations on compact styles. Terminal display stays compact:
ReprEntry.toterminalstill does not dump per-frame locations forline/no(the terminal plugin uses crashline / skips FAILURES as before).Test plan
pytest testing/code/test_excinfo.py testing/test_terminal.py::TestGenericReporting testing/test_reports.py -q→ 230 passed, 11 skippedtest_compact_tb_styles_keep_reprfileloc_for_pluginsfor--tb=lineand--tb=no14720.bugfix.rst+ AUTHORSFixes #14720