Skip to content

Improve parametrize error for non-sequence values#14693

Open
aouxwoux wants to merge 2 commits into
pytest-dev:mainfrom
aouxwoux:codex/parametrize-value-error
Open

Improve parametrize error for non-sequence values#14693
aouxwoux wants to merge 2 commits into
pytest-dev:mainfrom
aouxwoux:codex/parametrize-value-error

Conversation

@aouxwoux

Copy link
Copy Markdown

Fixes #14619.

When a trailing-comma parametrization receives a scalar value such as None, collection currently raises an unhandled TypeError while checking len(param.values). Report a normal, actionable parametrization error instead, and add a regression test.

Tests:

  • python -m pytest testing/test_mark.py -q
  • python -m compileall -q src/_pytest/mark testing/test_mark.py

aouxwoux added 2 commits July 10, 2026 17:18
Signed-off-by: aouxwoux <81102668+aouxwoux@users.noreply.github.com>
Signed-off-by: aouxwoux <81102668+aouxwoux@users.noreply.github.com>
@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Jul 10, 2026
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.

Spurious comma in parametrize causes obfuscated crash

1 participant