Skip to content

fix: improve error message when parametrize values is not iterable#14712

Closed
fazalpsinfo-cmyk wants to merge 2 commits into
pytest-dev:mainfrom
fazalpsinfo-cmyk:fix/parametrize-error-msg
Closed

fix: improve error message when parametrize values is not iterable#14712
fazalpsinfo-cmyk wants to merge 2 commits into
pytest-dev:mainfrom
fazalpsinfo-cmyk:fix/parametrize-error-msg

Conversation

@fazalpsinfo-cmyk

Copy link
Copy Markdown

When a trailing comma in argnames causes a scalar value (e.g. None) to be parsed as a single-element tuple, len(param.values) raises TypeError: object of type 'NoneType' has no len().

This wraps the len() call in a try/except TypeError and shows a helpful message explaining the trailing comma pitfall instead of a cryptic crash.

Part of #14619


Support my open source work: https://buymeacoffee.com/muhamedfazalps

Muhamed Fazal PS and others added 2 commits July 16, 2026 19:46
When a trailing comma in argnames causes a scalar value to be parsed
as a single-element tuple, TypeError is raised on len(None). Catch
this and show a helpful error message.

Part of pytest-dev#14619
@The-Compiler

Copy link
Copy Markdown
Member
image

I have to ask, was a human ever involved in the process of opening this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants