From bc469d6321819d767a4682b3e1a5ae4dd3dfe434 Mon Sep 17 00:00:00 2001 From: YohannMrg <98689112+yohannmarguier@users.noreply.github.com> Date: Thu, 16 Jul 2026 14:19:22 +0200 Subject: [PATCH] Replace iterator argvalues before pytest 10 itertools.product returns a one-shot iterator; passing it directly as parametrize argvalues is deprecated (PytestRemovedIn10Warning) and becomes a collection error in pytest 10. Materialize it with list(). Make PytestRemovedIn10Warning an error in [tool.pytest.ini_options] filterwarnings so every pytest run (local and CI) fails on removed-in-10 usage before an unbounded pytest upgrade does. Verified: python -m pytest python/tests -W error::pytest.PytestRemovedIn10Warning passes (15 passed, 5 skipped), all six test_ALException cases still collect, and the old iterator pattern now fails collection under the new filter. Closes #48 (cherry picked from commit 72747281f346c48f22d9eb2b17b9c4f90733fa76) --- pyproject.toml | 5 +++++ python/tests/test_exception.py | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 68165362..622f5ebc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -116,6 +116,11 @@ local_scheme = "no-local-version" [tool.pytest.ini_options] testpaths = ["python/tests"] +filterwarnings = [ + # pytest-10 deprecations are errors so removed-in-10 usage (e.g. iterator + # argvalues, issue #48) fails here before an unbounded pytest upgrade does + "error::pytest.PytestRemovedIn10Warning", +] [tool.coverage.run] branch = true diff --git a/python/tests/test_exception.py b/python/tests/test_exception.py index 9b86433d..b3c0a400 100644 --- a/python/tests/test_exception.py +++ b/python/tests/test_exception.py @@ -7,7 +7,8 @@ @pytest.mark.parametrize( "message, status", - itertools.product(["an exception", "another exception"], [None, -3, 44]), + # materialized: pytest 10 rejects non-Collection iterables as argvalues + list(itertools.product(["an exception", "another exception"], [None, -3, 44])), ) def test_ALException(message, status): match = message