Skip to content

Commit 986eb4a

Browse files
committed
Test overriding a fixture that requests a parametrized fixture
Closes: #11075
1 parent 8950ca3 commit 986eb4a

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

testing/python/fixtures.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5399,3 +5399,30 @@ def test_it(request, fix1):
53995399
)
54005400
result = pytester.runpytest("-v")
54015401
result.assert_outcomes(passed=1)
5402+
5403+
5404+
def test_overridden_fixture_depends_on_parametrized(pytester: Pytester) -> None:
5405+
"""#11075"""
5406+
pytester.makepyfile(
5407+
"""
5408+
import pytest
5409+
5410+
@pytest.fixture(params=["foo"])
5411+
def fixture_foo(request):
5412+
yield request.param
5413+
5414+
@pytest.fixture
5415+
def fixture_bar(fixture_foo):
5416+
yield fixture_foo
5417+
5418+
class TestFoobar:
5419+
@pytest.fixture
5420+
def fixture_bar(self, fixture_bar):
5421+
yield fixture_bar
5422+
5423+
def test_foobar(self, fixture_bar):
5424+
assert fixture_bar == "foo"
5425+
"""
5426+
)
5427+
result = pytester.runpytest("-v")
5428+
result.assert_outcomes(passed=1)

0 commit comments

Comments
 (0)