Calling fixtures directly is now an error instead of a warning
Fix #4545
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user