25 lines
522 B
Python
25 lines
522 B
Python
"""Shared pytest fixtures."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sqlite3
|
|
|
|
import pytest
|
|
|
|
from claire.db import migrate, open_db
|
|
from claire.hlc import HLCGenerator
|
|
|
|
|
|
@pytest.fixture
|
|
def conn() -> sqlite3.Connection:
|
|
"""In-memory SQLite DB with migrations applied."""
|
|
c = open_db(":memory:")
|
|
migrate(c)
|
|
yield c
|
|
c.close()
|
|
|
|
|
|
@pytest.fixture
|
|
def gen() -> HLCGenerator:
|
|
"""HLC generator pinned to a deterministic machine_id for tests."""
|
|
return HLCGenerator(machine_id="test-machine-0000")
|