feat(tg-fitness-bot): add test suite with pre-commit hook
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>
This commit is contained in:
parent
a934c46746
commit
e7ac2b174f
5 changed files with 435 additions and 0 deletions
18
tests/conftest.py
Normal file
18
tests/conftest.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue