"""Shared pytest fixtures for Kasualdad LFED tests.""" import sys from pathlib import Path # Ensure the project root is on sys.path for imports PROJECT_ROOT = Path(__file__).parent.parent sys.path.insert(0, str(PROJECT_ROOT)) import pytest from data_engine import create_session @pytest.fixture def db(): """Fresh seeded DuckDB connection for each test.""" conn = create_session() yield conn conn.close() @pytest.fixture def schema(): """Canonical schema dict matching seed data.""" return { "enrollment": [ ("school_year", "VARCHAR", "The school year (format 'YYYY-YYYY')"), ("school_name", "VARCHAR", "Name of the school"), ("grade_level", "INTEGER", "Grade level (K=0, 1-12)"), ("student_count", "INTEGER", "Number of students enrolled in that grade"), ], "attendance": [ ("student_id", "INTEGER", "Unique student identifier"), ("school_name", "VARCHAR", "Name of the school the student attends"), ("school_year", "VARCHAR", "The school year (format 'YYYY-YYYY')"), ("absence_count", "INTEGER", "Total absences for the school year"), ("is_chronically_absent", "BOOLEAN", "TRUE if student missed >= 10% of school days"), ], }