"""Shared test fixtures for teleo-pipeline tests."""

import sqlite3

import pytest

from lib import db


@pytest.fixture
def conn():
    """In-memory SQLite connection with full schema. Fresh per test."""
    connection = sqlite3.connect(":memory:")
    connection.row_factory = sqlite3.Row
    connection.execute("PRAGMA journal_mode=WAL")
    connection.execute("PRAGMA busy_timeout=10000")
    # Run migrations to create schema
    db.migrate(connection)
    yield connection
    connection.close()
