-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
topic: parametrizerelated to @pytest.mark.parametrizerelated to @pytest.mark.parametrizetype: enhancementnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branch
Description
Originally reported by: Ivan Smirnov (BitBucket: aldanor, GitHub: aldanor)
Is it too restrictive to assert that ids
in Metafunc.parametrize
must always have length? It might be more Pythonic to try and create a list of len(argvalues)
elements out of ids
first:
...
idfn = None
if callable(ids):
idfn = ids
ids = None
if ids and len(ids) != len(argvalues):
raise ValueError('%d tests specified with %d ids' %(
len(argvalues), len(ids)))
...
An example use case could be something like this (enumerate the parametrized tests):
@pytest.mark.parametrize('param', ['foo', 'bar', 'baz'], ids=itertools.count())
def some_test(x):
# ...
blueyed
Metadata
Metadata
Assignees
Labels
topic: parametrizerelated to @pytest.mark.parametrizerelated to @pytest.mark.parametrizetype: enhancementnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branch