Skip to content

Commit bd915fb

Browse files
committed
Pass a list to parametrize in test_docs_examples (pytest 9.1.0 compat)
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.
1 parent 47bbab3 commit bd915fb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tests/test_examples.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ async def test_desktop(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
9494

9595

9696
# TODO(v2): Change back to README.md when v2 is released
97-
@pytest.mark.parametrize("example", find_examples("README.v2.md"), ids=str)
97+
@pytest.mark.parametrize("example", list(find_examples("README.v2.md")), ids=str)
9898
def test_docs_examples(example: CodeExample, eval_example: EvalExample):
9999
ruff_ignore: list[str] = ["F841", "I001", "F821"] # F821: undefined names (snippets lack imports)
100100

0 commit comments

Comments
 (0)