Fix pytest collection errors from trailing comma in parametrize argnames#7450
Merged
Conversation
pytest 9.1.0 (released 2026-06-13) shipped pytest-dev/pytest#14125, which fixes pytest-dev/pytest#719: a trailing comma in a string argnames value (e.g. "args, " or "config_file_name,") now behaves like the tuple form ("arg",) and unpacks each value as a tuple. Before 9.1.0 the trailing comma was discarded and the value was passed as-is for the single argname, so these tests passed by accident. After the change pytest unpacks each value, and our non-tuple values no longer match the single argname, failing collection: - "args, " + value {} -> names (1) != values (0) - "config_file_name," + "config.yaml" -> names (1) != values (11) (the string is unpacked into its 11 characters) These tests date back to 2021 and were unchanged; tox does not pin pytest, so CI picked up 9.1.0 two days after its release and exposed the latent issue. Fix: drop the trailing comma so each value is treated as a single argument on every pytest version. Refs: pytest-dev/pytest#14125 pytest-dev/pytest#719 pytest 9.1.0 changelog: https://docs.pytest.org/en/stable/changelog.html
d0e984c to
ac3144a
Compare
hehe7318
approved these changes
Jun 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes
Root cause: pytest 9.1.0 (released 2026-06-13) shipped #14125 (pytest-dev/pytest#14125) / #719 (pytest-dev/pytest#719), which makes a trailing comma in string argnames ("arg,") behave like the tuple form ("arg",) and unpack each value as a tuple. Our 2021-era tests used "args, " / "config_file_name," with
▎ non-tuple values, so values now unpack to the wrong arity ({}→0, "config.yaml"→11 chars) and collection fails. tox doesn't pin pytest, so CI picked up 9.1.0 two days after its release. Fix: drop the trailing comma.
Tests
References
Checklist
developadd the branch name as prefix in the PR title (e.g.[release-3.6]).Please review the guidelines for contributing and Pull Request Instructions.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.