Using dict to provide ids for pytest.mark.parametrize #7977
Labels
topic: parametrize
related to @pytest.mark.parametrize
type: proposal
proposal for a new feature, often to gather opinions or design the API around the new feature
As it is right now, to provide non-default test IDs when using
pytest.mark.parametrize
, one must use theids
keyword arg.However, a thought occurred to me: What if we supply a
dict
to parametrize's argvalues, and from that dict, use the keys as the don-default test IDs?For example, rather than:
we can supply it more succinctly like so:
Users who absolutely need ordering can still use the first one, or use
OrderedDict
(or standard dict in Python>=3.7, where dict ordering became a language feature.)The text was updated successfully, but these errors were encountered: