GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — pytest 9.1.0 does not allow overriding fixture's parameters via `@pytest.mark.parametrize(..., indirect=True)` anymore · Issue #14591 · pytest-dev/pytest

pytest 9.1.0 does not allow overriding fixture's parameters via @pytest.mark.parametrize(..., indirect=True) anymore #14591

New issue
Copy link
New issue
Copy link
Closed
Closed
pytest 9.1.0 does not allow overriding fixture's parameters via @pytest.mark.parametrize(..., indirect=True) anymore#14591
Copy link

Description

@rokm
rokm
opened on Jun 13, 2026
Issue body actions

In pytest 9.1.0, using @pytest.mark.parametrize(..., indirect=True) does not seem to override parameters of a fixture that has parameters explicitly set (i.e., @pytest.fixture(params=[...])) - attempting to do so now results in duplicate parametrization of {fixture_name} error.

This worked with previous releases. git bisect points to d56b1af (and reverting it restores the old behavior).

Minimal example (modeled after pyi_builder fixture from PyInstaller, see here and here):

# test_myfixture.py
import pytest


class MyFixture:
    def __init__(self, mode):
        self.mode = mode

    def do_something(self):
        # Do something depending on self.mode
        pass


@pytest.fixture(params=['first_mode', 'second_mode'])
def myfixture(request):
    yield MyFixture(request.param)


# [1]: typically, both modes are tested
def test_myfixture_default(myfixture):
    assert isinstance(myfixture, MyFixture)
    assert myfixture.mode in {'first_mode', 'second_mode'}
    myfixture.do_something()


# [2]: sometimes, a specific mode is forced
@pytest.mark.parametrize('myfixture', ['first_mode'], indirect=True)
def test_myfixture_single_mode1(myfixture):
    assert isinstance(myfixture, MyFixture)
    assert myfixture.mode == 'first_mode'
    myfixture.do_something()


@pytest.mark.parametrize('myfixture', ['second_mode'], indirect=True)
def test_myfixture_single_mode2(myfixture):
    assert isinstance(myfixture, MyFixture)
    assert myfixture.mode == 'second_mode'
    myfixture.do_something()

Running with 9.0.3:

$ pytest -v -rsfE test_myfixture.py
================================================================================== test session starts ===================================================================================
platform linux -- Python 3.14.5, pytest-9.0.3, pluggy-1.6.0 -- /home/rok/tmp/pyi-pytest/venv/bin/python
cachedir: .pytest_cache
rootdir: /home/rok/tmp/pyi-pytest/myfixture
collected 4 items                                                                                                                                                                        

test_myfixture.py::test_myfixture_default[first_mode] PASSED                                                                                                                       [ 25%]
test_myfixture.py::test_myfixture_default[second_mode] PASSED                                                                                                                      [ 50%]
test_myfixture.py::test_myfixture_single_mode1[first_mode] PASSED                                                                                                                  [ 75%]
test_myfixture.py::test_myfixture_single_mode2[second_mode] PASSED                                                                                                                 [100%]

=================================================================================== 4 passed in 0.01s ====================================================================================

Running with pytest 9.1.0:

$ pytest -v -rsfE test_myfixture.py
================================================================================== test session starts ===================================================================================
platform linux -- Python 3.14.5, pytest-9.1.0, pluggy-1.6.0 -- /home/rok/tmp/pyi-pytest/venv/bin/python
cachedir: .pytest_cache
rootdir: /home/rok/tmp/pyi-pytest/myfixture
collected 0 items / 1 error                                                                                                                                                              

========================================================================================= ERRORS =========================================================================================
___________________________________________________________________________ ERROR collecting test_myfixture.py ___________________________________________________________________________
test_myfixture.py::test_myfixture_single_mode1: duplicate parametrization of 'myfixture'
================================================================================ short test summary info =================================================================================
ERROR test_myfixture.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
==================================================================================== 1 error in 0.05s ====================================================================================

Since I cannot seem to find any mention of the behavior change in the changelog, I would like to check if the change is intended or not, before making any changes on our end...

Reacted by Marc Schmitzer, akamainwoltman and Martin Toft Bay
Reacted by aiudirog

Activity

  1. rouault
    added 2 commits that reference this issue on Jun 14, 2026

    autotest/requirements.txt: avoid pytest 9.1.0 because of pytest-dev/p…

    9808916

    autotest/requirements.txt: avoid pytest 9.1.0 because of pytest-dev/p…

    b69ef6d
  2. bluetech commented on Jun 14, 2026

    @bluetech
    bluetech
    on Jun 14, 2026
    Member
    More actions

    Thanks for the report and the bisect. Will fix for 9.0.1.

  3. li-em
    added a commit that references this issue on Jun 15, 2026

    Pin pytest to 9.0.3 to avoid upstream bug (earth-mover#2208)

    95e858e
  4. connorjward
    added a commit that references this issue on Jun 15, 2026

    Fix SLATE test for pytest 9.1.0 (#5179)

    21eb435
  5. bluetech commented on Jun 15, 2026

    @bluetech
    bluetech
    on Jun 15, 2026
    Member
    More actions

    Fixed in #14597. Will be released in 9.1.1, hopefully this weekend.

    Reacted by Martin Toft Bay, layday, Luiz Irber, Marc Schmitzer, Adam, Dmytro Makhno, William F. Broderick, Agriya Khetarpal and David Hoese
  6. bluetech
    closed this as completedon Jun 15, 2026
  7. d-v-b
    added a commit that references this issue on Jun 16, 2026

    harden dependency environment (#4066)

    3c79d96
  8. jbrockmendel
    added a commit that references this issue on Jun 18, 2026

    CI: pin pytest <9.1 in cibuildwheel test phase

    02d4004
  9. RonnyPfannschmidt
    marked Getting duplicate parametrization error with pytest==9.1.0 #14623 as a duplicate of this issue on Jun 18, 2026
  10. jbrockmendel
    added a commit that references this issue on Jun 21, 2026

    CI: drop pytest 9.1 exclusion in wheel test phase

    e636c0c
  11. MateoGreil
    added a commit that references this issue on Jul 4, 2026

    ⬆️ Update dependency pytest to v9.1.1 (#24)

    45da729
  12. luketainton
    added a commit that references this issue on Jul 19, 2026

    [SECURITY] Update dependency pytest to v9 [SECURITY] (#2)

    fca183b
  13. Djeex
    added a commit that references this issue on Aug 31, 2026

    Update dependency pytest to v9 (#35)

    f96ce2f
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.