Files
animaltrack/tests/conftest.py
Petru Paler d213abf9d9 chore: add pre-commit hook with ruff and pytest
- Add git pre-commit hook running ruff check, ruff format, pytest
- Fix import ordering in conftest.py
- Add placeholder test for test infrastructure
- Generate flake.lock

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 17:41:32 +00:00

24 lines
668 B
Python

# ABOUTME: Pytest configuration and fixtures for AnimalTrack tests.
# ABOUTME: Provides database fixtures, test clients, and common utilities.
import os
import tempfile
import pytest
@pytest.fixture
def temp_db_path():
"""Create a temporary database file path for testing."""
with tempfile.NamedTemporaryFile(suffix=".db", delete=False) as f:
db_path = f.name
yield db_path
# Cleanup
if os.path.exists(db_path):
os.unlink(db_path)
# Also clean up WAL files if they exist
for suffix in ["-shm", "-wal", "-journal"]:
wal_path = db_path + suffix
if os.path.exists(wal_path):
os.unlink(wal_path)