-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Open
Labels
type: docsdocumentation improvement, missing or needing clarificationdocumentation improvement, missing or needing clarificationtype: proposalproposal for a new feature, often to gather opinions or design the API around the new featureproposal for a new feature, often to gather opinions or design the API around the new feature
Description
Problem
Currently, pytest's command-line options are only documented in the pytest --help output. While comprehensive, this format has limitations:
- Not easily searchable - Users must scan through the entire help text
- Not browsable online - Help text isn't part of the web documentation
- Difficult to discover - Users may not know what options exist for their use case
- Hard to reference - Can't easily link to specific options in discussions or other docs
This addresses the long-standing issue #4492 which requests CLI usage documentation be added to the online docs.
Proposed Solution
Add a dedicated "CLI Options Reference" page in the documentation (doc/en/how-to/cli-options.rst) that:
-
Organizes options by category for easier navigation:
- Running and Selecting Tests
- Output and Verbosity
- Debugging and Profiling
- Logging
- Coverage and Reporting
- Warnings
- Fixtures
- Caching
- Configuration
-
Provides context and examples for commonly-used options
-
Cross-references to related comprehensive documentation sections
-
Makes options discoverable through the searchable online docs
Example Structure
Running and Selecting Tests
----------------------------
-k EXPRESSION
Only run tests matching the given expression
See: :ref:`mark examples`
-x, --exitfirst
Exit instantly on first error or failed testImplementation Approach
Rather than auto-generating docs with sphinx-argparse (as suggested in #4492), I propose a manually curated reference that:
- Focuses on commonly-used options
- Provides helpful context and usage examples
- Organizes logically by use case
- Links to detailed documentation where applicable
Trade-offs:
- ✅ More user-friendly and contextual
- ✅ Better organized for learning
- ❌ Requires manual maintenance to stay in sync
Related
- Addresses Missing docs for CLI usage #4492
- Draft implementation available at PR Add CLI options reference documentation #13930
Metadata
Metadata
Assignees
Labels
type: docsdocumentation improvement, missing or needing clarificationdocumentation improvement, missing or needing clarificationtype: proposalproposal for a new feature, often to gather opinions or design the API around the new featureproposal for a new feature, often to gather opinions or design the API around the new feature