-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Combining multiple @pytest.mark.parametrize lines #815
Comments
This currently works for me (tested in import pytest
@pytest.mark.parametrize('foo', ['a', 'b', 'c'])
@pytest.mark.parametrize('bar', [1, 2, 3])
def test_things(foo, bar):
assert foo in ['a', 'b', 'c']
assert bar in [1, 2, 3]
Did you have something else in mind? |
Oh wow, that works indeed! I didn't expect that 😄 I wonder if it's intended or by accident - now the question is if it should be pointed out in the docs, and if there are tests for it. |
Not sure if it's intended, but a PR for the docs would be welcome. 😄 Can we close this then? |
I want to contribute a PR for docs (and tests, if there aren't any yet) before closing this - though I probably won't have time for that until (or after?) EuroPython. |
No problem! 😄 |
Thank you. |
I sometimes write tests something like this:
to test all combinations of
foo
andbar
. Theitertools.product
call sometimes gets a bit more complicated which makes this hard to follow.IMHO, it'd be nicer to be able to write those tests like this:
And pytest would then generate all possible combinations. What are your thoughts on this?
I'm not sure if the difference between using two args in one
parametrize
call vs. using twoparametrize
calls with one argument each is too subtle, though.The text was updated successfully, but these errors were encountered: