pytest-dev / pytest-dev/pytest
terminal: add --name-only option to show only names of failed tests
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?
When running large test suites, failed tests often produce a significant amount of output including tracebacks, captured logs, and stdout/stderr. If many tests fail simultaneously, identifying the specific tests that failed becomes difficult as the names are buried under pages of detailed error information. While options like -q or --tb=no exist, they often hide too much information or don't provide the structured "FAILURES" and "ERRORS" sections that help in quickly scanning results.
Describe the solution you'd like
A new command-line option --name-only that modifies the terminal output to only show the names of failed or erring tests.
When enabled:
- The FAILURES section lists only the test names (e.g., test_fail1).
- The ERRORS section lists the error headlines (e.g., ERROR at setup of test_error or ERROR collecting
test_file.py). - All detailed tracebacks and captured output sections are suppressed for these failures.
Example output:
1 ============================= FAILURES =============================
2 test_fail1
3 test_fail2
4 ====================== short test summary info ======================
5 FAILED test_file.py::test_fail1 - assert False
6 FAILED test_file.py::test_fail2 - assert False
7 ========================= 2 failed in 0.05s =========================
Alternative Solutions
- Using
--tb=noor--tb=line: These reduce output but either remove the summary headers entirely or still include error messages that can be quite verbose. - Piping to grep: Users often pipe pytest output to grep to extract failure names, but this is fragile and loses pytest's color formatting and structural grouping.
PR
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 reviewing pytest's terminal output implementation and the linked PR #14451. The work is done when --name-only lists failed test names and error headlines while suppressing detailed tracebacks and captured output, without removing the FAILURES and ERRORS sections.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100