-
-
Couldn't load subscription status.
- Fork 2.9k
Closed as duplicate of#5621
Copy link
Labels
topic: parametrizerelated to @pytest.mark.parametrizerelated to @pytest.mark.parametrize
Description
Someone in a pytest training of mine was surprised that:
import pytest
@pytest.mark.parametrize("a", ["a1", "a2"])
@pytest.mark.parametrize("b", ["b1", "b2"])
def test_permutations(a, b):
...results in pytest collecting:
test_permutations[b1-a1]test_permutations[b1-a2]test_permutations[b2-a1]test_permutations[b2-a2]
Where the arguments are represented as b-a despite the test argument order being a, b.
I suspect this is because the decorators are applied from bottom to top (and indeed swapping them also generates "nicer" IDs). But I wonder if we could/should do better in cases where the parameters directly correspond to test arguments.
Metadata
Metadata
Assignees
Labels
topic: parametrizerelated to @pytest.mark.parametrizerelated to @pytest.mark.parametrize