Files
openrun/tests/unit/test_smoke.py
2026-05-19 08:34:22 -04:00

36 lines
916 B
Python

"""Smoke test — verifies the test scaffolding itself works.
If this passes, `uv run pytest` is wired up, the `tmp_conn` fixture builds a
DB from `openrun.db.SCHEMA`, and the schema covers every table that loaders
in `openrun.model` reference.
"""
from __future__ import annotations
EXPECTED_TABLES = frozenset({
"activities",
"activity_splits",
"activity_fit_files",
"activity_time_in_zone",
"daily_steps",
"daily_sleep",
"daily_stress",
"daily_hrv",
"daily_body_battery",
"daily_intensity_minutes",
"daily_resting_hr",
"sync_state",
})
def test_tmp_conn_applies_full_schema(tmp_conn) -> None:
tables = {
row[0]
for row in tmp_conn.execute(
"SELECT name FROM sqlite_master WHERE type='table'"
)
}
missing = EXPECTED_TABLES - tables
assert not missing, f"schema is missing expected tables: {sorted(missing)}"