Skip to content

Fix pytest collection errors from trailing comma in parametrize argnames#7450

Merged
himani2411 merged 1 commit into
aws:developfrom
himani2411:pytest-failure
Jun 16, 2026
Merged

Fix pytest collection errors from trailing comma in parametrize argnames#7450
himani2411 merged 1 commit into
aws:developfrom
himani2411:pytest-failure

Conversation

@himani2411

@himani2411 himani2411 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

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

  • GH actions

References

  • Link to impacted open issues.
  • Link to related PRs in other packages (i.e. cookbook, node).
  • Link to documentation useful to understand the changes.

Checklist

  • Make sure you are pointing to the right branch.
  • If you're creating a patch for a branch other than develop add the branch name as prefix in the PR title (e.g. [release-3.6]).
  • Check all commits' messages are clear, describing what and why vs how.
  • Make sure to have added unit tests or integration tests to cover the new/modified code.
  • Check if documentation is impacted by this change.

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.

@himani2411 himani2411 requested review from a team as code owners June 15, 2026 20:25
@himani2411 himani2411 added skip-changelog-update Disables the check that enforces changelog updates in PRs 3.x labels Jun 15, 2026
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
@himani2411 himani2411 enabled auto-merge (rebase) June 15, 2026 21:15
@himani2411 himani2411 merged commit d88b035 into aws:develop Jun 16, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.x skip-changelog-update Disables the check that enforces changelog updates in PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants