pytest icon indicating copy to clipboard operation
pytest copied to clipboard

Resolve param indices using param values, not parameterset index

Open sadra-barikbin opened this issue 2 years ago • 10 comments

To compute param indices smarter when user passes multiple parameter sets with duplicate values to parametrize in order to have a better reordering experience. Currently we have :

@pytest.fixture(scope='module')
def fixture1(request):
    pass

@pytest.fixture(scope='module')
def fixture2(request):
    pass

@pytest.mark.parametrize("fixture1, fixture2", [("a", 0), ("b", 1), ("a", 2)], indirect=True)
def test(fixture1, fixture2):
    pass

resulting in inefficient ordering i.e.

<Function test[a-0]>
<Function test[b-1]>
<Function test[a-2]>

It's a follow-up to #11220 .

sadra-barikbin avatar Jul 28 '23 23:07 sadra-barikbin

@bluetech after some review of #519 and #2207 i believe it looks fair to consider the ordering more correct

i think we need a crosscheck of how we can observe interactions if people have multiple tests with different sets of parameters and their setup/teardown

RonnyPfannschmidt avatar Jul 29 '23 10:07 RonnyPfannschmidt

@sadra-barikbin Can you please rebase this on latest main?

bluetech avatar Aug 10 '23 06:08 bluetech

Apologies but I'll be delayed in reviewing this, I'm still down with a cold

It would have been nice to land this in 8.x

RonnyPfannschmidt avatar Dec 30 '23 15:12 RonnyPfannschmidt

Apologies but I'll be delayed in reviewing this, I'm still down with a cold

It would have been nice to land this in 8.x

It's alright. I hope you recover soon.

sadra-barikbin avatar Dec 30 '23 18:12 sadra-barikbin

@bluetech , could you please review the PR too?

sadra-barikbin avatar Jan 09 '24 19:01 sadra-barikbin

Hi @sadra-barikbin, do we have any plan to merge this PR, please? cc. @RonnyPfannschmidt

cyw233 avatar May 13 '24 23:05 cyw233

Just resolved a minor conflict. Let's see if we can get this merged as it is already approved.

obestwalter avatar Jun 20 '24 11:06 obestwalter

Our shiny new bot also enforces changelog entries now, so this needs to be added before it can be merged - could you please add that @sadra-barikbin?

obestwalter avatar Jun 20 '24 14:06 obestwalter