fixture '{name}' does not return anything, add leading underscore
This rule does not fire on abstract fixtures (those decorated with @abc.abstractmethod),
so that only the actual fixture implementations will be checked.
This rule also does not fire on fixtures containing yield from, because there is
no reasonable way to determine whether the generator yields a value.
Bad code:
import pytest
@pytest.fixture()
def patch_something(mocker):
mocker.patch('module.object')
@pytest.fixture()
def use_context():
with create_context():
yieldGood code:
import pytest
@pytest.fixture()
def _patch_something(mocker):
mocker.patch('module.object')
@pytest.fixture()
def _use_context():
with create_context():
yield- to enforce a naming convention for fixtures:
fixtures that don't return a value start with a leading underscore (e.g.
_patch_something), fixtures that return a value don't start with a leading underscore (e.g.some_object)
See also PT005.