MCPcopy Create free account
hub / github.com/0010aor/FlashNotes / db

Function db

backend/tests/conftest.py:17–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15
16@pytest.fixture
17def db() -> Generator[Session, None, None]:
18 with Session(engine) as session:
19 init_db(session)
20 yield session
21 try:
22 statement = select(User).options(
23 selectinload(User.collections), selectinload(User.practice_sessions)
24 )
25 users = session.exec(statement).all()
26 for user in users:
27 session.delete(user)
28 session.commit()
29 except Exception as e:
30 print(f"Error during cleanup: {e}")
31 session.rollback()
32
33
34@pytest.fixture

Callers

nothing calls this directly

Calls 2

init_dbFunction · 0.90
deleteMethod · 0.65

Tested by

no test coverage detected