pytest icon indicating copy to clipboard operation
pytest copied to clipboard

terminal: add --name-only option to show only names of failed tests

Open Vlor999 opened this issue 6 months ago • 1 comments

Add --name-only option to show only names of failed tests

Add a new CLI argument --name-only that displays only the test name or collection error headline when a test fails. This is useful for quickly identifying failures in large test suites without the noise of full tracebacks or capture sections.

  • Register --name-only in pytest_addoption.
  • Modify summary_failures_combined and summary_errors to honor the flag.
  • Add documentation in doc/en/reference/reference.rst.
  • Add regression tests in testing/test_name_only.py.
  • Add news fragment in changelog/14443.feature.rst.
  • Update AUTHORS.

  • [X] Include documentation when adding new features.
  • [X] Include new tests or update existing tests when applicable.
  • [X] Allow maintainers to push and squash when merging my commits.

Closes: #14452

Vlor999 avatar May 09 '26 09:05 Vlor999

Thanks for the review. I pushed a follow-up that makes --name-only --tb=line show only the failure headline, and added coverage for --name-only -v and --name-only --show-capture=no.

Vlor999 avatar Jun 15 '26 16:06 Vlor999