1.x updates

This commit is contained in:
2026-05-19 08:34:22 -04:00
parent 3f3fce62d3
commit 9d91ac8ebc
53 changed files with 4541 additions and 2111 deletions

28
tests/conftest.py Normal file
View File

@@ -0,0 +1,28 @@
"""Shared pytest fixtures for openrun tests.
The `tmp_conn` fixture provides a fresh in-memory SQLite connection with the
full openrun schema applied — every test that touches the DB should request
this rather than `openrun.db.connect()` so the live `data/garmin.db` is never
read or written by the test suite.
"""
from __future__ import annotations
import sqlite3
import pytest
from openrun.db import SCHEMA
@pytest.fixture
def tmp_conn() -> sqlite3.Connection:
"""Fresh in-memory SQLite with the openrun schema applied."""
conn = sqlite3.connect(":memory:")
conn.execute("PRAGMA foreign_keys = ON")
conn.row_factory = sqlite3.Row
conn.executescript(SCHEMA)
try:
yield conn
finally:
conn.close()