Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@parametrize: custom ids are not taken into account for lazy_value argvalues when a single lazy value is used for a tuple of parameters #144

Closed
smarie opened this issue Nov 5, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@smarie
Copy link
Owner

smarie commented Nov 5, 2020

From #142 @romanponomaryov found out this bug that can be reduced down to:

from pytest_cases import parametrize_with_cases

def case_dumb():
    return 1, 2

def generate_id(**args):
    return "hello"

@parametrize_with_cases('dummy_amount, exp_amount', cases='.', idgen=generate_id)
def test_tuples(dummy_amount, exp_amount):
    assert True

The issue is that the custom id "hello" is not taken into account

@smarie smarie added the bug Something isn't working label Nov 5, 2020
@smarie
Copy link
Owner Author

smarie commented Nov 26, 2020

For reference this issue is actually lower-level and can be reproduced with

from pytest_cases import lazy_value, parametrize

def case_dumb():
    return 1, 2

@parametrize("a,b", [(1, object()), lazy_value(case_dumb)], ids=["hello", "world"])
def test_foo2(a, b):
    pass

It yields:

test_tmp.py::test_foo2[hello] 
test_tmp.py::test_foo2[case_dumb] 

So the custom id is not taken into account for the lazy value.

@smarie smarie changed the title @parametrize_with_cases: idgen does not seem to be taken into account when cases are unpacked into a tuple @parametrize: custom ids are not taken into account for lazy_value argvalues when a single lazy value is used for a tuple of parameters Nov 26, 2020
@smarie smarie closed this as completed in 492bf80 Nov 26, 2020
@smarie
Copy link
Owner Author

smarie commented Nov 26, 2020

@romanponomaryov this will ship with 2.4.0 probably topday when travis wakes up : it seems to be extremely slow these days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant