Skip to content

Expose a public traceback filter for custom test nodes - #15313

Open
boyfeiyu wants to merge 1 commit into
pytest-dev:mainfrom
boyfeiyu:boyf-190-public-traceback-filter
Open

boyfeiyu wants to merge 1 commit into
pytest-dev:mainfrom
boyfeiyu:boyf-190-public-traceback-filter

Conversation

@boyfeiyu

@boyfeiyu boyfeiyu commented Nov 1, 2026

Copy link
Copy Markdown

Custom Item subclasses currently need to override a private method and import private types to filter tracebacks while retaining pytest's standard failure formatting.

This adds Node.traceback_filter and exports pytest.Traceback and pytest.TracebackEntry. The public method delegates to _traceback_filter by default, so existing overrides and the filtering provided by Function and collectors continue to work. An explicit public override takes precedence when both names are overridden. Tests cover Python and non-Python items, collectors, traceback styles, --full-trace, legacy overrides and special failures.

Related #15297. This addresses the public customization and typing API; default hidden-frame filtering is unchanged. It does not implement a global traceback hook.

Validation on macOS arm64 / CPython 3.13.18:

  • Related regression suite: 1345 passed, 25 skipped, 5 xfailed.
  • Node tests: 66 passed. The corresponding baseline control fails for public overrides and passes for the legacy override.
  • All applicable pre-commit hooks passed, including mypy.
  • Strict Sphinx HTML build passed without warnings.

The full platform/Python matrix has not been run locally.

  • Documentation and tests included.
  • Changelog entry and AUTHORS entry included.
  • AI agents credited in the commit's Co-authored-by trailer.
  • Allow maintainers to push and squash when merging my commits.

Co-authored-by: multica-agent <github@multica.ai>
@pyba-chronographer pyba-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Nov 1, 2026
@boyfeiyu
boyfeiyu force-pushed the boyf-190-public-traceback-filter branch from 4b9a849 to 1a39ca3 Compare November 1, 2026 10:10

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.

1 participant