[Pytest-commit] Issue #464: Allow mixtures of fixture + parameterization marks (hpk42/pytest)

vmalloc issues-reply at bitbucket.org
Mon Feb 17 14:12:14 CET 2014


New issue 464: Allow mixtures of fixture + parameterization marks
https://bitbucket.org/hpk42/pytest/issue/464/allow-mixtures-of-fixture-parameterization

vmalloc:

Given the following code:

```python
import pytest

@pytest.fixture
def arg1():
    return 1

@pytest.mark.parameterize("arg2", [2, 22])
def test(arg1, arg2):
    pass

```

py.test complains that arg2 isn't a known fixture. However, in this case it could have been deduced pretty easily, since there is an explicit parameterization of the *arg2* parameter.

Being able to mix the two fixture can be incredibly useful:

```python

@pytest.mark.parameterize("with_https", [True, False])
def test_webserver(webserver, with_https):
    ...
```

In the above example, webserver can be obtained from a fixture (thus benefitting from finalization and more), while with_https is a mere boolean flag, and would be an overkill to turn into a full-blown fixture function.




More information about the pytest-commit mailing list