-
Notifications
You must be signed in to change notification settings - Fork 40
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
Using a @fixture returning a list of params to parametrize a test #235
Comments
Hi @DavidDahan1, thanks for this issue ! I updated it because it was not readable "as is" .. |
It seems that you want a fixture to return a list of parameters. This is not possible with See also this answer: #205 (comment) Note that pytest-cases is not repsonsible for this limitation, it is the way fixtures and parameters are defined in pytest. So you'll need to create a copy of val_to_list_of_tuples = data_manipulation(give_some_val_not_fixture)
@parametrize(argsnames="event,data", argvals=val_to_list_of_tuples)
# either a test, or a fixture, would be parametrized that way. |
Closing this now - please feel free to reopen if the above answer does not correspond to your actual question |
Hey fellow maintainers, I'll be glad to have your guidance..
I'm trying to use pytest cases to parameterize a test with a list of tuples(str, iterable) that is yielded from a (pytest-cases)@fixture, but something isn't working for me.
It goes like the following:
To clarify, the yielded value looks something like:
[('event_name': {'uuid1','uuid2'}), ('another_event_name': {'uuid3', 'uuid4'}),(..),....]
again, list of tuples(string, set) .
when I try to implement this (either with @paytest.mark.parametrize or via @parametrize) like so:
it seems like pytest can't create more tests nodes..
instead, it creates just one test node and it fails to recognize the structure of ("name1,name2", list_of_tuples_with_2_elements)
instead it treats every element in the list as a single param.
I mean:
event = ('event_name': {'uuid1','uuid2'})
data = ('another_event_name': {'uuid3', 'uuid4'})
and that's it. no more test nodes.
I've gone through the docs multiple times but I can't find the answer.
Highly appreciate your time if you got so far!
The text was updated successfully, but these errors were encountered: