Skip to content
Sarj Code Standards

duplicate-pytest-fixture-params

Review repeated immutable values in a pytest fixture parameter list.

Why

Each fixture parameter reruns its dependent tests. Repeating the same immutable literal can add execution time without exercising a distinct input; Ruff PT014 covers test parametrization, not fixture params.

Fix

Review the dependent test contracts, then remove an accidental duplicate. Preserve intentional repetition with explicit case IDs or an exact SARJ524 suppression explaining the repeated-run contract.

Examples

Before — flagged The same input schedules the dependent tests twice
tests/conftest.py
import pytest
@pytest.fixture(params=("empty", "empty"))
def payload(request):
return request.param
After — preferred Each fixture parameter represents a distinct input
tests/conftest.py
import pytest
@pytest.fixture(params=("empty", "filled"))
def payload(request):
return request.param