From ed6701c90b105562f3672a89700691f0f11485c7 Mon Sep 17 00:00:00 2001 From: andrewwillowen <60939910+andrewwillowen@users.noreply.github.com> Date: Sun, 21 Sep 2025 13:00:34 -0500 Subject: [PATCH 1/2] Update parametrize.rst Add warning about using generators as the value argument --- doc/en/how-to/parametrize.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/en/how-to/parametrize.rst b/doc/en/how-to/parametrize.rst index fe186146434..b485377266b 100644 --- a/doc/en/how-to/parametrize.rst +++ b/doc/en/how-to/parametrize.rst @@ -194,6 +194,15 @@ To get all combinations of multiple parametrized arguments you can stack This will run the test with the arguments set to ``x=0/y=2``, ``x=1/y=2``, ``x=0/y=3``, and ``x=1/y=3`` exhausting parameters in the order of the decorators. +.. warning:: + + Do not use a generator as the value argument for + :ref:`pytest.mark.parametrize ref` when decorating a class or module: + the first test will consume the values of the generator and + subsequent tests will be skipped because the generator is empty. + + Use a list or other iterable instead of a generator. + .. _`pytest_generate_tests`: Basic ``pytest_generate_tests`` example From a516aa6cf9709995dd05be40baf7869a9ddb25e7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 21 Sep 2025 18:08:14 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- doc/en/how-to/parametrize.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/en/how-to/parametrize.rst b/doc/en/how-to/parametrize.rst index b485377266b..6c51c4821b3 100644 --- a/doc/en/how-to/parametrize.rst +++ b/doc/en/how-to/parametrize.rst @@ -196,7 +196,7 @@ This will run the test with the arguments set to ``x=0/y=2``, ``x=1/y=2``, .. warning:: - Do not use a generator as the value argument for + Do not use a generator as the value argument for :ref:`pytest.mark.parametrize ref` when decorating a class or module: the first test will consume the values of the generator and subsequent tests will be skipped because the generator is empty.