Skip to content

Document how to load custom options with --pyargs - #15462

Open
AyaanshC wants to merge 1 commit into
pytest-dev:mainfrom
AyaanshC:codex/document-pyargs-plugin-options
Open

AyaanshC wants to merge 1 commit into
pytest-dev:mainfrom
AyaanshC:codex/document-pyargs-plugin-options

Conversation

@AyaanshC

Copy link
Copy Markdown

What changed

Document why custom options in an installed test package's conftest.py can be unrecognized with --pyargs. Show how to register the option in an importable plugin and load it with -p before argument parsing.

Refs #9739.

Verification

  • Reproduced the usage error from a different working directory with the option in the package's test conftest.py. Moving its hook to an explicitly loaded plugin made the same test pass.
  • tox -e docs passed with Python 3.14, and the new links resolve in the generated page.
  • Applicable pre-commit checks passed.

AI assistance

OpenAI Codex assisted with the documentation, verification example, and PR description. I reviewed the patch and will respond to maintainer feedback.

Show how to register custom options before command-line parsing.

Refs pytest-dev#9739
@pyba-chronographer pyba-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Nov 26, 2026

Copy link
Copy Markdown
Member

🤖 Written by Claude Opus 5.5 via Claude Code for the pytest maintainers; I prompted it, it did the work, I read it.

The mechanism described is accurate. With --pyargs, the dotted name isn't a filesystem path, so the package's conftest.py is only picked up during collection, after option parsing.

Two small requests:


Generated by Claude Code

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.

2 participants