Repository navigation
Add --tb-hide-internal option to hide pytest/pluggy frames with --full-trace - #14708
Open
pctablet505 wants to merge 2 commits into
Open
pctablet505 wants to merge 2 commits into
pctablet505 wants to merge 2 commits into
Conversation
--tb-hide-internal option to hide pytest/pluggy frames with --full-trace
pctablet505
marked this pull request as ready for review
July 24, 2026 16:42
pctablet505
force-pushed
the
fix-9509-hide-pluggy-full-trace
branch
from
August 21, 2026 15:19
ffc1ebe to
212e3ad
Compare
pctablet505
force-pushed
the
fix-9509-hide-pluggy-full-trace
branch
from
September 11, 2026 09:46
212e3ad to
c772c3a
Compare
Added --tb-hide-internal option that, when used together with --full-trace, hides pytest/pluggy internal frames from the traceback while still showing the full user-written traceback. Fixes pytest-dev#9509
pctablet505
force-pushed
the
fix-9509-hide-pluggy-full-trace
branch
from
September 28, 2026 09:25
c772c3a to
83d99c6
Compare
This branch has not been deployed
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 #9509
--full-traceturns off traceback filtering entirely, so a failure report includes every pytest and pluggy frame between the runner and the test. This adds--tb-hide-internal, which keeps the long, uncut traceback but drops those internal frames.--full-traceon its own behaves as before.Change
With
--full-trace,Node._repr_failure_pypassestbfilter=False. If--tb-hide-internalis also given, it filters with the existing_pytest._code.code.filter_tracebackinstead, which drops frames from pytest, pluggy and generated code (<...>filenames). Nothing is cut at the test file, so non-pytest frames above the test stay visible.__tracebackhide__is still ignored, same as plain--full-trace. The flag has no effect without--full-trace.Tests
test_fulltrace_hide_internalruns a failing test through a helper. With--fulltracealone, the output containspluggy/*.pyand_pytest/runner.pyframes. With--tb-hide-internaladded, neither appears. Both cases still show thehelper()andassert Falselines.Open question
On the issue, RonnyPfannschmidt suggested a more general filter, e.g.
--traceback-skip-toplevel=pluggy,sqlalchemy,django.orm, as a step towards #283. This PR only does the narrow pytest/pluggy case that the issue asks for. Would you accept that as is, or would you rather have the general option?how-to/output.rstand the referencechangelog/9509.feature.rstAUTHORSCo-authored-bycommit trailersAI-assisted: this change was prepared with help from AI tools and reviewed by pctablet505; it was not generated autonomously.