Skip to content

Pass lists instead of itertools.product iterators to parametrize - #297

Merged
rhpvorderman merged 1 commit into
pycompression:developfrom
ptweezy:parametrize-lists
Oct 27, 2026
Merged

rhpvorderman merged 1 commit into
pycompression:developfrom
ptweezy:parametrize-lists

Conversation

@ptweezy

@ptweezy ptweezy commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

pytest 9.1 deprecated passing an iterator, such as itertools.product(...), as the argument values of parametrize. These calls cause 17 of the 19 warnings on most CI jobs:

PytestRemovedIn10Warning: Passing a non-Collection iterable to parametrize is deprecated.

pytest 10.0.0 turns this warning into an error. The filter is already in pytest's source, commented out with "To be enabled in pytest 10.0.0". With that filter (-W error::pytest.PytestRemovedIn10Warning), pytest cannot collect tests/test_compat.py, tests/test_igzip_lib.py, and tests/test_igzip_threaded.py, and it runs no tests at all. CI installs pytest without a version, so every test job would fail when pytest 10.0.0 is released.

This PR wraps 16 of the 17 calls in list(). The call for test_threaded_write is in #294, because that PR changes the next line. The collected tests and their IDs do not change.

This PR changes only tests, so it has no CHANGELOG entry.

Checklist

  • Pull request details were added to CHANGELOG.rst
  • Documentation was updated (if needed)

pytest 9.1 deprecated iterators as parametrize argument values, and
pytest 10 turns the PytestRemovedIn10Warning into an error, which stops
test collection. The call for test_threaded_write is left to pycompression#294,
which changes the line after it.
ptweezy added a commit to ptweezy/python-isal that referenced this pull request Oct 24, 2026
pytest 10 turns the PytestRemovedIn10Warning for iterators into an
error. pycompression#297 changes the other calls, but this decorator is next to the
line that the previous commit changes.
@rhpvorderman

Copy link
Copy Markdown
Collaborator

I wonder why pytest simply did not call list themselves? It is just one line of code. Sometimes these changes baffle me a bit. Thanks for fixing.

@rhpvorderman
rhpvorderman merged commit 45fa56d into pycompression:develop Oct 27, 2026
22 checks passed
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