pytest + pytest-asyncio in flake.nix. 53 tests covering parser (all formats, error cases) and db (CRUD, soft delete, update, stats, pagination). Pre-commit hook runs tests when fitness bot files are staged. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
18 lines
423 B
Python
18 lines
423 B
Python
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
# Add project root to path so tests can import modules directly
|
|
sys.path.insert(0, str(Path(__file__).parent.parent))
|
|
|
|
|
|
@pytest.fixture
|
|
def tmp_db(monkeypatch, tmp_path):
|
|
"""Provide a fresh SQLite database for each test."""
|
|
import db
|
|
|
|
db_file = tmp_path / "test_workouts.db"
|
|
monkeypatch.setattr(db, "DB_PATH", db_file)
|
|
db.init_db()
|
|
return db_file
|