Skip to content

fix: keep frame locations in longrepr under --tb=line/no#14729

Closed
l46983284-cpu wants to merge 1 commit into
pytest-dev:mainfrom
l46983284-cpu:fix/tb-compact-keep-reprfileloc-14720
Closed

fix: keep frame locations in longrepr under --tb=line/no#14729
l46983284-cpu wants to merge 1 commit into
pytest-dev:mainfrom
l46983284-cpu:fix/tb-compact-keep-reprfileloc-14720

Conversation

@l46983284-cpu

Copy link
Copy Markdown

Summary

--tb=line and --tb=no used to build compact longrepr entries without reprfileloc. Plugins that suppress pytest's own traceback via --tb=no still saw reprentries, but every frame's file/line was None, so custom reporters silently lost location data.

This keeps structural frame locations on compact styles. Terminal display stays compact: ReprEntry.toterminal still does not dump per-frame locations for line/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 skipped
  • New regression: test_compact_tb_styles_keep_reprfileloc_for_plugins for --tb=line and --tb=no
  • ruff check + format on touched files
  • changelog fragment 14720.bugfix.rst + AUTHORS

Fixes #14720

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>
@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Jul 19, 2026
@l46983284-cpu

Copy link
Copy Markdown
Author

Hey @dprada — sorry, I opened this without noticing you already said you were happy to work on a patch yourself. That was on me.

pre-commit.ci is red on this PR anyway, so it's not in good shape. I'm closing #14729 and leaving #14720 with you. If any of the code is useful, take it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--tb affects longrepr construction, so plugins cannot suppress traceback display without losing traceback data

1 participant