Fixture Autouse with yield - Fixtures and Mocking in Python
Keyboard shortcuts
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
Fixture Autouse with yield
import pytest
@pytest.fixture(autouse = True)
def configuration():
print("Before")
yield
print("After")
def test_app():
print("In test")
assert True
$ pytest -sq
Before
In test
.After
1 passed in 0.02 seconds