paper-dynasty-database/tests/conftest.py
Cal Corum 11a499c0ec feat: SQL migration for evolution tables and variant/image_url columns (#69)
Closes #69

- Create migrations/2026-03-12_add_evolution_tables.sql: idempotent
  PostgreSQL migration (BEGIN/COMMIT, all IF NOT EXISTS) that creates
  player_season_stats, evolution_track, evolution_card_state,
  evolution_tier_boost, and evolution_cosmetic tables; adds card.variant
  (INTEGER NULL DEFAULT NULL), battingcard.image_url (VARCHAR(500) NULL),
  and pitchingcard.image_url (VARCHAR(500) NULL).
- Add tests/test_evolution_migration.py: 16 unit tests validate SQL file
  structure (tables, columns, indexes, FK references, idempotency); 6
  integration tests annotated for PostgreSQL execution when POSTGRES_HOST
  is set.
- Add tests/__init__.py and tests/conftest.py (shared test infrastructure
  required for import isolation).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 18:08:31 -05:00

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")