fixtures: fix incorrect "duplicate parametrization" when using indirect=[...]#13976
Merged
bluetech merged 3 commits intoNov 20, 2025
Merged
Conversation
6 tasks
|
I tested this with the downstream test suite which lead to #13974 and with this PR the tests are back to passing. Thanks for the quick fix! |
The function name is ambiguous, full nodeid is more helpful.
Needed for the next commit.
…ect=[...]` The code in `_get_direct_parametrize_args` only handled `indirect=True/False`, it didn't account for `indirect=[...]`. This caused the added test to start failing after d56b1af. Fix by using the common `_resolve_args_directness` function. It's a bit heavy for the task but correctness first... Fix pytest-dev#13974.
48d3478 to
adcdeb9
Compare
RonnyPfannschmidt
approved these changes
Nov 20, 2025
|
Hi @bluetech , Cannot find anything in changelog to 9.1.0 like compatibility change. import pytest
DEFAULT = ["a", "b", "c"]
@pytest.fixture(params=DEFAULT)
def target(request):
return request.param
@pytest.mark.parametrize(
"target",
["a", "b"], # override default
indirect=True,
)
def test_foo(target):
assert Truewhich used to work on 9.0.3 (the motivation fixture in conftest has default), is causing And must be fixed using pytest_generate_tests, making "target" parametless. @pytest.fixture
def target(request):
return request.param
def pytest_generate_tests(self, metafunc: Metafunc) -> None:
if not_missing_default(metafunc): # function that iter_markers("parametrize") and its args
return
metafunc.parametrize('target', DEFAULT, indirect=True)Like https://github.com/datachain-ai/datachain/pull/1818/changes |
Member
Author
henryiii
added a commit
to scikit-build/scikit-build-core
that referenced
this pull request
Jun 16, 2026
🤖 _AI text below_ 🤖 ## Problem pytest 9.1.0 shipped a regression ([pytest-dev/pytest#13974](pytest-dev/pytest#13974), fixed upstream in [#13976](pytest-dev/pytest#13976), landing in 9.1.1) where overriding a `params=`-fixture via `@pytest.mark.parametrize(..., indirect=True)` raises `duplicate parametrization` at collection time. Because our config sets `filterwarnings = ["error"]` and these surface as collection errors, the suite hard-fails on the three tests that override the `editable` fixture (defined with `params=[None, "redirect", "inplace"]` in `tests/conftest.py`): - `test_editable.py::test_cython_pxd` - `test_editable_generated.py::test_generated_files` - `test_pyproject_pep660.py::test_pep660_wheel` ## Fix Pin `pytest >=7.2,!=9.1.0` in the `test-core` dependency group. The exclusion is narrow: 9.1.1+ (with the upstream fix) is allowed once released. No test code changes needed. Verified collection is clean (622 tests, no errors) with the pin applied. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The code in
_get_direct_parametrize_argsonly handledindirect=True/False, it didn't account forindirect=[...]. This caused the added test to start failing after d56b1af.Fix by using the common
_resolve_args_directnessfunction. It's a bit heavy for the task but correctness first...Fix #13974.
I am not marking for backport because the bug was laying dormant for a while and only uncovered by d56b1af which is only in main, not yet released.