-
-
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
Add support for dictionary argvalues
for parametrize
#5487
Comments
argvalues
for parametrize
argvalues
for parametrize
I'm -1 You can already do this which satisfies the same thing without creating more edge cases: @pytest.mark.parametrize(["a", "b"], (pytest.param(1, 2, id='test 1'), pytest.param(3, 4, id='test 2'))) |
I completely missed that in the guide, using |
I think using Currently: @pytest.mark.parametrize(
["a", "b"], (
pytest.param(1, 2, id='test 1'),
pytest.param(3, 4, id='test 2'),
)
) New: @pytest.mark.parametrize(
["a", "b"], {
'test 1': (1, 2),
'test 2': (3, 4),
}
) A workaround is of course to use a dict in the first place, and then use that, @pytest.mark.parametrize("a,b", t.values(), ids=list(t.keys()) It feels pretty natural to use a dict here, since the ID is supposed to be unique. For reference: I've created https://github.com/blueyed/pytest-enhancements, which includes this. |
I'd like to be able to pass a dictionary to
pytest.mark.parametrize
asargvalues
with the keys asids
and the values asargvalues
For example:
would generate two tests named "test 1" and "test 2".
Before trying to add this feature I wanted to make sure there's no foreseen issues with a making change like this.
The text was updated successfully, but these errors were encountered: