Skip to content

Fix hidden traceback frames in custom test items - #15256

Open
jwalith4418-Mj wants to merge 1 commit into
pytest-dev:mainfrom
jwalith4418-Mj:fix/custom-item-hidden-tracebacks
Open

jwalith4418-Mj wants to merge 1 commit into
pytest-dev:mainfrom
jwalith4418-Mj:fix/custom-item-hidden-tracebacks

Conversation

@jwalith4418-Mj

Copy link
Copy Markdown

Custom test items inherit Node._traceback_filter, which returns the traceback unchanged and exposes frames marked with __tracebackhide__. Apply the existing traceback filter so custom items honor that marker while --full-trace continues to show the full traceback. This does not remove unmarked framework frames.

Fixes #7692.

The regression uses a custom collector/item and checks ValueError and pytest.fail, each with and without --full-trace. It fails in the two normal-output cases on unchanged main and passes all four cases with the fix. Includes a changelog entry and AUTHORS update.

Validation on Windows, Python 3.12.14:

  • Full suite: 4606 passed, 150 skipped, 13 xfailed, 1 xpassed (python -m pytest -n 2 testing -q).
  • Node/runner tests: 85 passed, 1 xfailed.
  • Applicable Ruff, formatting, spelling and text checks passed. Windows Application Control blocked the native mypy hook; the supported pure-Python build of the same pinned mypy 2.4.0 passed for both changed Python files.

AI assistance: OpenAI Codex (GPT-6) prepared the patch, tests, and this description and is credited in the commit trailer. The contributor confirmed reviewing and understanding commit 62d32fccf and taking responsibility for its submission.

Custom items inherit Node's default traceback filter, which returned the
traceback without applying __tracebackhide__. Use the existing filter so
marked helper and internal frames are omitted unless full tracebacks are
explicitly requested.

Cover ValueError and pytest.fail through a public custom collector/item,
with and without --full-trace. Add the changelog and contributor entry.

Fixes pytest-dev#7692.

Co-authored-by: OpenAI Codex <noreply@openai.com>
@pyba-chronographer pyba-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Oct 24, 2026

This branch has not been deployed

No deployments
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.

Bug: Traceback cleanup fails on Exception/pytest.fail in Item.runtest

1 participant