Skip to content

Omit redundant File header in SyntaxError collection output - #15189

Open
avenet wants to merge 26 commits into
pytest-dev:mainfrom
avenet:fix-14994-redundant-syntaxerror-file-line
Open

avenet wants to merge 26 commits into
pytest-dev:mainfrom
avenet:fix-14994-redundant-syntaxerror-file-line

Conversation

@avenet

@avenet avenet commented Oct 16, 2026

Copy link
Copy Markdown

Summary

Follow-up to #14899 / #14994: during collection, when the FILE:LINE:COLUMN crash line is appended, drop the now-redundant stdlib File "...", line N header from the E-block. Keep the source and caret lines, and leave the no-column fallback and runtime --tb=* paths unchanged.

Depends on #14899 (this branch is based on it; once that merges, this PR's diff shrinks to the collection-path change alone).

Before:

E     File "test_broken.py", line 1
E       def broken(:
E                  ^
E   SyntaxError: invalid syntax
test_broken.py:1:12: SyntaxError: invalid syntax

After:

E       def broken(:
E                  ^
E   SyntaxError: invalid syntax
test_broken.py:1:12: SyntaxError: invalid syntax

Test plan

  • Collection of def broken(: shows caret + file:line:col, no File header

  • IndentationError collection likewise omits the header

  • SyntaxError without offset still keeps the File header

  • Runtime --tb=long still shows the File header

  • testing/code + collection/terminal/reports/junitxml (784 passed)

  • pre-commit run on touched files

  • Include documentation when adding new features.

  • Include new tests or update existing tests when applicable.

  • Allow maintainers to push and squash when merging my commits.

  • Closes Redundant File ..., line N block in SyntaxError output #14994

  • If AI agents were used, they are credited in Co-authored-by commit trailers.

  • Create a new changelog file in the changelog directory (14994.improvement.rst).

  • Add yourself to AUTHORS in alphabetical order.

SemTiOne and others added 24 commits August 18, 2026 12:52
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
When the file:line:col crash line is shown (pytest-dev#14899), the stdlib
File/line header in the E-block only repeats that location.

Co-authored-by: Cursor <cursoragent@cursor.com>
@pyba-chronographer pyba-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Oct 16, 2026
avenet and others added 2 commits October 16, 2026 00:06
pluggy 1.7.0 documents list_plugin_distinfo with a private
pluggy._compat.DistFacade cross-reference that Sphinx cannot resolve
under nitpicky mode, breaking RTD with fail_on_warning.

Co-authored-by: Cursor <cursoragent@cursor.com>
@SemTiOne

Copy link
Copy Markdown
Contributor

Thanks, but why are my commits included here?

@RonnyPfannschmidt

Copy link
Copy Markdown
Member

this is a stacked pr jsut without a github pr stack feautre being used

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.

Redundant File ..., line N block in SyntaxError output

3 participants