disallow yield in non-yield-fixtures for now. This is an incompataibility but we want to prepare for possibly merging fixture and yield_fixture some day.

This commit is contained in:
holger krekel
2013-09-30 13:56:54 +02:00
parent 086d4e4ced
commit de35b077a2
3 changed files with 29 additions and 3 deletions

View File

@@ -2087,3 +2087,18 @@ class TestContextManagerFixtureFuncs:
*def arg1*
""")
def test_yield_not_allowed_in_non_yield(self, testdir):
testdir.makepyfile("""
import pytest
@pytest.fixture(scope="module")
def arg1():
yield 1
def test_1(arg1):
pass
""")
result = testdir.runpytest("-s")
result.stdout.fnmatch_lines("""
*fixture*cannot use*yield*
*def arg1*
""")