Calling fixtures directly is now an error instead of a warning

Fix #4545
This commit is contained in:
Bruno Oliveira
2018-12-18 21:05:48 -02:00
parent 8563364d8b
commit 0115766df3
6 changed files with 79 additions and 81 deletions

View File

@@ -3850,3 +3850,14 @@ class TestScopeOrdering(object):
)
reprec = testdir.inline_run()
reprec.assertoutcome(passed=2)
def test_call_fixture_function_error():
"""Check if an error is raised if a fixture function is called directly (#4545)"""
@pytest.fixture
def fix():
return 1
with pytest.raises(pytest.fail.Exception):
assert fix() == 1