File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33import pytest
44from fastapi .testclient import TestClient
5- from sqlmodel import Session
5+ from sqlmodel import Session , delete
66
77from app .core .config import settings
88from app .db .engine import engine
9+ from app .db .init_db import init_db
910from app .main import app
11+ from app .models import Item , User
1012from app .tests .utils .user import authentication_token_from_email
1113from app .tests .utils .utils import get_superuser_token_headers
1214
1315
14- @pytest .fixture (scope = "session" )
16+ @pytest .fixture (scope = "session" , autouse = True )
1517def db () -> Generator :
1618 with Session (engine ) as session :
19+ init_db (session )
1720 yield session
21+ statement = delete (Item )
22+ session .execute (statement )
23+ statement = delete (User )
24+ session .execute (statement )
25+ session .commit ()
1826
1927
2028@pytest .fixture (scope = "module" )
You can’t perform that action at this time.
0 commit comments