bigbiggerbiggestbot/tests/conftest.py
Danny e7ac2b174f 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>
2026-04-13 20:41:03 +02:00

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