Coverage for tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests006.py: 100%
14 statements
« prev ^ index » next coverage.py v7.6.12, created at 2025-03-07 05:42 +0000
« prev ^ index » next coverage.py v7.6.12, created at 2025-03-07 05:42 +0000
1import importlib 1gabcdef
3import pytest 1gabcdef
4from fastapi.testclient import TestClient 1gabcdef
5from sqlmodel import Session 1gabcdef
7from docs_src.tutorial.fastapi.app_testing.tutorial001 import main as app_mod 1gabcdef
8from docs_src.tutorial.fastapi.app_testing.tutorial001 import test_main_006 as test_mod 1gabcdef
9from docs_src.tutorial.fastapi.app_testing.tutorial001.test_main_006 import ( 1gabcdef
10 client_fixture,
11 session_fixture,
12)
14assert session_fixture, "This keeps the session fixture used below" 1gabcdef
15assert client_fixture, "This keeps the client fixture used below" 1gabcdef
18@pytest.fixture(name="prepare") 1gabcdef
19def prepare_fixture(clear_sqlmodel): 1abcdef
20 # Trigger side effects of registering table models in SQLModel
21 # This has to be called after clear_sqlmodel, but before the session_fixture
22 # That's why the extra custom fixture here
23 importlib.reload(app_mod) 1gabcdef
26def test_tutorial(prepare, session: Session, client: TestClient): 1gabcdef
27 test_mod.test_create_hero(client) 1hijklmn