support override of the parametrized fixture on the test level

--HG--
branch : parametrized-fixture-override
This commit is contained in:
Anatoly Bubenkov
2015-03-01 15:15:37 +01:00
parent 060609317a
commit c4623939af
2 changed files with 23 additions and 3 deletions

View File

@@ -401,6 +401,23 @@ class TestFunction:
rec.assertoutcome(passed=1)
def test_parametrize_overrides_parametrized_fixture(self, testdir):
"""Test parametrization when parameter overrides existing parametrized fixture with same name."""
testdir.makepyfile("""
import pytest
@pytest.fixture(params=[1, 2])
def value(request):
return request.param
@pytest.mark.parametrize('value',
['overrided'])
def test_overrided_via_param(value):
assert value == 'overrided'
""")
rec = testdir.inline_run()
rec.assertoutcome(passed=1)
def test_parametrize_with_mark(selfself, testdir):
items = testdir.getitems("""
import pytest