Skip to content

fix(main): preserve parametrization in collection not found error diagnostic - #15423

Closed
abhishekrajv7-cmd wants to merge 1 commit into
pytest-dev:mainfrom
abhishekrajv7-cmd:fix/notfound-parametrization-diagnostic
Closed

abhishekrajv7-cmd wants to merge 1 commit into
pytest-dev:mainfrom
abhishekrajv7-cmd:fix/notfound-parametrization-diagnostic

Conversation

@abhishekrajv7-cmd

Copy link
Copy Markdown
  • Include documentation when adding new features.
  • Include new tests or update existing tests when applicable.
  • Allow maintainers to push and squash when merging my commits.

closes #15422

Description

When selecting a non-existent parametrized test ID on the command line (for example pytest "test_x.py::test_x[missing]"), the ERROR: not found: collection diagnostic omitted the requested [missing] parametrization and reported only test_x.py::test_x.

This is misleading because test_x does exist, while only the requested parameter variant does not.

This PR appends parametrization (when present) to report_arg in Session.perform_collect before recording to self._notfound.

Verification

  • Added regression test test_not_found_with_parametrization in testing/acceptance_test.py.
  • Ran tests locally (pytest testing/test_main.py, pytest testing/acceptance_test.py).
  • Checked formatting and linting with ruff.
  • Added newsfragment in changelog/15422.bugfix.rst.
  • Added entry to AUTHORS.

…gnostic

When selecting a non-existent parametrized test ID (such as 	est_x.py::test_x[missing]), the collection not found diagnostic omitted the parametrization suffix from the reported argument, misleadingly reporting that the base test was not found. Append the parametrization to report_arg in Session.perform_collect when present.
@pyba-chronographer pyba-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Nov 21, 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.

Closing as an AI drive-by. The source change is the fix suggested in #15422, copied line for line. This PR was opened 16 minutes after a different account filed that issue, with no word on the issue, no AI disclosure, and as one of 7 PRs to 6 unrelated projects today. Nothing here shows a person picked the issue or will engage with review.

Our AI policy: https://github.com/pytest-dev/pytest/blob/main/CONTRIBUTING.rst. If you want to work on an issue, comment on it first in your own words and say what you understand and plan to do.


Generated by Claude Code

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.

Collection "not found" error drops the requested [params] parametrization

2 participants