Pass a list to parametrize in test_docs_examples (pytest 9.1.0 compat)#2890
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. find_examples() returns a generator; materialize it as a list. Same fix as #2889 on v1.x. main's CI matrix uses locked resolution so this is not currently failing there, but it future-proofs against a pytest bump.
There was a problem hiding this comment.
LGTM — straightforward one-line test fix wrapping find_examples() in list() for pytest 9.1.0 parametrize compatibility.
Extended reasoning...
Overview
This PR changes a single line in tests/test_examples.py, wrapping find_examples("README.v2.md") in list(...) so that pytest.mark.parametrize receives a materialized Collection rather than a generator. This is test-only code with no impact on the library or any production code path.
Security risks
None. The change touches only test collection/parametrization and introduces no new inputs, network, auth, or data-handling logic.
Level of scrutiny
Low. This is a mechanical, well-understood fix: pytest 9.1.0 deprecates passing non-Collection iterables to parametrize, and the canonical remedy is to materialize the generator into a list. The PR description notes it mirrors #2889 on v1.x and was verified locally (45 tests pass under pytest 9.1.0 with -W error).
Other factors
No bugs were reported by the bug hunting system, the diff is a single line, intent is clear, and there is no reviewer discussion outstanding. ids=str behavior is unchanged. Safe to approve without human review.
pytest 9.1.0 deprecates passing a non-Collection iterable (e.g. a generator) to
pytest.mark.parametrize, raisingPytestRemovedIn10Warning. Withfilterwarnings = ["error"]this fails collection.pytest_examples.find_examples()returns a generator; materialize it as a list.Same fix as #2889 on
v1.x.main's CI matrix useslockedresolution (pytest 8.4.2) so this is not currently failing there, but it future-proofs against the next pytest bump inuv.lock. Verified locally thattests/test_examples.pycollects clean and all 45 tests pass under pytest 9.1.0 with-W error.The
uv.lockbump to 9.1.0 is deliberately left for a separate PR.AI Disclaimer