Skip to content

Add help output for a single option group - #15270

Open
Thibault-dlr wants to merge 1 commit into
pytest-dev:mainfrom
Thibault-dlr:fix-9452-custom-help
Open

Thibault-dlr wants to merge 1 commit into
pytest-dev:mainfrom
Thibault-dlr:fix-9452-custom-help

Conversation

@Thibault-dlr

Copy link
Copy Markdown

Summary

  • Add --help-section=NAME to display help for a single command-line option group.
  • Use custom for options registered without an explicit group.
  • Allow named groups, including plugin groups, to be selected by their Parser.getgroup() name.
  • Preserve the existing output of pytest --help.

Testing

  • testing/test_helpconfig.py testing/test_parseopt.py testing/test_config.py — 376 passed, 4 skipped, 1 xfailed.
  • git diff --check — passed.

Ruff, pre-commit, and Towncrier were unavailable in the local environment and were not run.

Implementation notes

The custom identifier is reserved for options registered without an explicit group. To avoid ambiguity, a named group literally called custom, or one whose name starts with group:, can be selected by prefixing its name with group:. For example: --help-section=group:custom.

Help formatting reuses argparse's formatter and option actions. The use of argparse's internal formatter API is localized in pytest's Parser, but may require adjustments if argparse internals change.

@pyba-chronographer pyba-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Oct 27, 2026

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.

1 participant