New issue 759: Allow parametrize ids to accept generators
https://bitbucket.org/pytest-dev/pytest/issue/759/allow-parametrize-ids-to-accept-generators

Ivan Smirnov:

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:

```python
...
        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):
```python
@pytest.mark.parametrize('param', ['foo', 'bar', 'baz'], ids=itertools.count())
def some_test(x):
    # ...
```



_______________________________________________
pytest-commit mailing list
pytest-commit@python.org
https://mail.python.org/mailman/listinfo/pytest-commit

Reply via email to