pytest-dev / pytest-dev/pytest
Redundant `File ..., line N` block in SyntaxError output
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
What's the problem this feature will solve?
Since #14899 the crash line already carries file:line:col, making the E-block's File/source/caret lines redundant:
E File "package/lib.py", line 1
E def broken(:
E ^
E SyntaxError: invalid syntax
package/lib.py:1:12: SyntaxError: invalid syntax
Describe the solution you'd like
Omit the File block when the crash line carries the error's own file+line, keep it on the fallback path so no info is ever lost.
Alternative Solutions
Leave as is (stdlib default).
Additional context
Deferred from #14899. Related: #2388.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing pytest's SyntaxError reporting path and compare the output for the crash-line path with the fallback path. Confirm where the File/source/caret block is assembled, then add or update coverage so the block is omitted when the error supplies its own file and line while remaining present on fallback output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100