You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
python: allow adding parameter names to parametrized test IDs
By default, only the parameter's values make it into parametrized test
IDs. The parameter names don't. Since parameter values do not always
speak for themselves, the test function + test ID are often not
descriptive/expressive.
Allowing parameter name=value pairs in the test ID optionally to get an idea
what parameters a test gets passed is beneficial. So add a kwarg
`id_names` to @pytest.mark.parametrize() / pytest.Metafunc.parametrize(). It defaults
to `False` to keep the auto-generated ID as before. If set to `True`,
the argument parameter=value pairs in the auto-generated test
IDs are enabled. Calling parametrize() with `ids` and `id_names=True` is
considered an error.
Auto-generated test ID with `id_names=False` (default behavior as
before):
test_something[100-10-True-False-True]
Test ID with `id_names=True`:
test_something[speed_down=100-speed_up=10-foo=True-bar=False-baz=True]
Signed-off-by: Bastian Krause <[email protected]>
``@pytest.mark.parametrize()`` and ``pytest.Metafunc.parametrize()`` now support the ``id_names`` argument enabling auto-generated test IDs consisting of parameter name=value pairs.
0 commit comments