Bug Fix 11456: Duplicated parameters in @pytest.mark.parametrize
This commit is contained in:
parent
92add35dca
commit
daa0c1b201
|
@ -0,0 +1,2 @@
|
|||
In this, we propose a solution that ensures the generation of unique identifiers for ParameterSets in the make_unique_parameterset_ids method in Python.py class. It appends numeric suffixes to identifiers, ensuring uniqueness even when the original identifiers have digit endings.
|
||||
If the id ends in a digit, make then new id f"{id}_{suffix}". If the new id is already in the set of seen ids, increment the suffix number and try again. This is sure to work, and even be fast in practice, because our maximum suffix is the number of duplicate ids we started with.
|
|
@ -0,0 +1,13 @@
|
|||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.parametrize("a", [1, 2, 10, 11, 2, 1, 12, 11, 2_1])
|
||||
def test_params(a):
|
||||
print("a:", a)
|
||||
assert a > 0
|
||||
|
||||
|
||||
@pytest.mark.parametrize("a", [1, 2, 10, 11, 2, 1, 12, 11])
|
||||
def test_params_1(a):
|
||||
print("a:", a)
|
||||
assert a > 0
|
Loading…
Reference in New Issue