Home-made fixture with yield
import pytest
@pytest.fixture()
def configuration():
print("Before")
yield { 'name' : 'Foo Bar' }
print("After")
def test_app(configuration):
print("In test")
print(configuration)
assert True
$ pytest -sq
Before
In test
{'name': 'Foo Bar'}
.After
1 passed in 0.02 seconds