[v1.x] Pass a list to parametrize in test_docs_examples (pytest 9.1.0 compat)#2889
Conversation
pytest 9.1.0 deprecates passing a non-Collection iterable (e.g. a generator) to pytest.mark.parametrize, raising PytestRemovedIn10Warning. With filterwarnings = ["error"] this fails collection on the highest-resolution CI lanes. find_examples() returns a generator; materialize it as a list.
There was a problem hiding this comment.
LGTM — straightforward pytest 9.1.0 compat fix, materializing the find_examples() generator into a list for parametrize.
Extended reasoning...
Overview
This PR changes a single line in tests/test_examples.py, wrapping find_examples("README.md") in list(...) so the value passed to pytest.mark.parametrize is a materialized Collection rather than a generator. This addresses PytestRemovedIn10Warning in pytest 9.1.0, which under filterwarnings = ["error"] was failing test collection on the highest-resolution CI lanes.
Security risks
None. The change is confined to test infrastructure and does not touch any shipped code, auth, crypto, or permissions.
Level of scrutiny
Minimal scrutiny warranted. This is a mechanical, idiomatic fix that pytest's own deprecation message explicitly recommends ("convert to a list or tuple"). Generators are single-pass, and parametrize iterates the argument once during collection, so materializing to a list is semantically equivalent and strictly safer.
Other factors
No bugs were reported by the bug hunting system, no prior review comments exist on the timeline, and the diff is a single self-contained line with clear intent. The behavior of test_docs_examples is unchanged.
pytest 9.1.0 deprecates passing a non-Collection iterable (e.g. a generator) to
pytest.mark.parametrize, raisingPytestRemovedIn10Warning. Withfilterwarnings = ["error"]this fails collection on thehighest-resolution CI lanes (alllowest-directlanes pass since they pin an older pytest).pytest_examples.find_examples()returns a generator; materialize it as a list. This is the fix pytest's own message recommends ("Please convert to a list or tuple").Test-infrastructure only; no change to shipped code. Unblocks the v1.28.0 publish run.
The same change will be needed on
main.AI Disclaimer