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

Pytest fails for find tests when @parametrize args are sets with multiple values #355

Open
TheCaffinatedDeveloper opened this issue Oct 30, 2024 · 0 comments

Comments

@TheCaffinatedDeveloper
Copy link

TheCaffinatedDeveloper commented Oct 30, 2024

I believe this has something to do with idgen at some point but when you do the following

class SomeCases:
    @parametrize(arg1=[{"set_value_1", "set_value_2"}, {}, {"set_value_1"})
    def case_some_case(arg1: set[str]) -> set[str]:
         return arg1

@parametrize_with_cases("arg", cases=SomeCases)
def test_some_cases(arg: set[str]) -> None:
    assert arg is not None

On the tests that use multiple values within the set, pytest is unable to locate them at run time even though it finds them during collection it seems.

Note: I actually was able to reproduce this within pytest itself when replacing their ids=with lambda x: f"arg1 {str(x)}" so perhaps not a pytest_cases specific issue? Could be another enhancement though :)

@TheCaffinatedDeveloper TheCaffinatedDeveloper changed the title Pytest fails for find tests when @parametrize args are iterables Pytest fails for find tests when @parametrize args are sets with multiple values Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant