perf: speed up test suite with parallel execution
- Enable pytest-xdist with -n auto for parallel test execution - Consolidate migrated_db fixture in conftest.py (was duplicated in 4 files) - Remove local fixture definitions and unused imports from test files Test execution: ~24s -> ~5s (~5x speedup) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
# ABOUTME: Tests for the reference data seeder.
|
||||
# ABOUTME: Validates that seeding populates correct data and is idempotent.
|
||||
|
||||
import pytest
|
||||
|
||||
from animaltrack.db import get_db
|
||||
from animaltrack.migrations import run_migrations
|
||||
from animaltrack.models.reference import ProductUnit, UserRole
|
||||
from animaltrack.repositories import (
|
||||
FeedTypeRepository,
|
||||
@@ -16,14 +12,6 @@ from animaltrack.repositories import (
|
||||
from animaltrack.seeds import run_seeds
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def migrated_db(tmp_path):
|
||||
"""Create a database with migrations applied."""
|
||||
db_path = str(tmp_path / "test.db")
|
||||
run_migrations(db_path, "migrations", verbose=False)
|
||||
return get_db(db_path)
|
||||
|
||||
|
||||
class TestSeedCounts:
|
||||
"""Tests that seeding creates the correct number of records."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user