Skip to content

"duplicate parametrization" errors with pytest dev #13974

Description

@braingram

I noticed some new failures with pytest-dev where collection errors are occuring with "duplicate parametrization" messages.

Here's a minimal example:

import pytest


@pytest.fixture(params=["a", "b"])
def target(request):
    return request.param


@pytest.fixture
def val(request):
    return int(request.param)


@pytest.mark.parametrize(
    "val, target",
    [
        ("1", 1),
        ("2", 2),
    ],
    indirect=["val"],
)
def test_foo(val, target):
    assert str(val) == str(target)

Starting with commit d56b1af
this triggers an error:

test_bar.py::test_foo: duplicate parametrization of 'target'

Prior to that commit the file runs as expected:

test_bar.py::test_foo[1-1] PASSED                                                                                                                                                                                 
test_bar.py::test_foo[2-2] PASSED

In case it's useful here is the link to a run that was impacted by this bug:
https://github.com/asdf-format/asdf/actions/runs/19420723535/job/55557560788#step:10:98

Thanks and let me know if there is any more information that would be helpful.

pip list output:

Package   Version                Editable project location
--------- ---------------------- ------------------------------------------------
iniconfig 2.3.0
packaging 25.0
pip       24.0
pluggy    1.6.0
Pygments  2.19.2
pytest    9.1.0.dev74+gbbb0c0778

[notice] A new release of pip is available: 24.0 -> 25.3
[notice] To update, run: python3.12 -m pip install --upgrade pip

Tested on mac os and python 3.12 (error in the above linked CI run was on linux and python 3.11).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: parametrizerelated to @pytest.mark.parametrizetype: bugproblem that needs to be addressedtype: regressionindicates a problem that was introduced in a release which was working previously

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions