Closes #73 Adds POST /api/v2/evolution/cards/{card_id}/evaluate — force-recalculates a card's evolution state from career totals (SUM across all player_season_stats rows for the player-team pair). Changes: - app/services/evolution_evaluator.py: evaluate_card() function that aggregates career stats, delegates to formula engine for value/tier computation, updates evolution_card_state with no-regression guarantee - app/routers_v2/evolution.py: POST /cards/{card_id}/evaluate endpoint plus existing GET /tracks and GET /tracks/{id} endpoints (WP-06) - tests/test_evolution_evaluator.py: 15 unit tests covering tier assignment, advancement, partial progress, idempotency, fully evolved, no regression, multi-season aggregation, missing state error, and return shape - tests/__init__.py, tests/conftest.py: shared test infrastructure All 15 tests pass. Models and formula engine are lazily imported so this module is safely importable before WP-01/WP-05/WP-07/WP-09 merge. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
15 lines
608 B
Python
15 lines
608 B
Python
"""Pytest configuration for the paper-dynasty-database test suite.
|
|
|
|
Sets DATABASE_TYPE=postgresql before any app module is imported so that
|
|
db_engine.py sets SKIP_TABLE_CREATION=True and does not try to mutate the
|
|
production SQLite file during test collection. Each test module is
|
|
responsible for binding models to its own in-memory database.
|
|
"""
|
|
|
|
import os
|
|
|
|
os.environ["DATABASE_TYPE"] = "postgresql"
|
|
# Provide dummy credentials so PooledPostgresqlDatabase can be instantiated
|
|
# without raising a configuration error (it will not actually be used).
|
|
os.environ.setdefault("POSTGRES_PASSWORD", "test-dummy")
|