no teardown in fixture {name}, use return instead of yield
yield
in fixtures is only useful and semantically correct
when the fixture contains some teardown code.
Bad code:
import pytest
@pytest.fixture()
def my_fixture():
resource = acquire_resource()
yield resource
Good code:
import pytest
@pytest.fixture()
def my_fixture_with_teardown():
resource = acquire_resource()
yield resource
resource.release()
@pytest.fixture()
def my_fixture_without_teardown():
resource = acquire_resource()
return resource
- to make sure that all
yield
usages are semanticaly correct