Fixture Autouse - 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

Fixtures and Mocking in Python

Fixture Autouse

import pytest

@pytest.fixture(autouse = True)
def configuration():
    print("Before")

def test_app():
    print("In test")
    assert True

$ pytest -sq
Before
In test
.

1 passed in 0.02 seconds