pytest
pytest copied to clipboard
terminal: add --name-only option to show only names of failed tests
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-onlyinpytest_addoption. - Modify
summary_failures_combinedandsummary_errorsto 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
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.