Closed
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):
# ...