Multiplayer scopone scientifico backend on the kaya framework:
- OIDC login (kaya-oidc), session-backed WebSocket auth
- Pure rules engine (forced captures, scopa, primiera scoring) with
full-match simulation tests
- Live game state in Redis (JSON + TTL, join codes, per-game locks,
pub/sub state push); in-memory fallback for tests
- WebSocket /ws/games/{id} for real-time play; REST lobby endpoints
(create/join/snapshot) with hidden-hand views
- Finished matches persisted to Postgres (Tortoise + aerich) for match
history and leaderboard endpoints
- Docker Compose stack: postgres, redis, mock-oauth2-server, db-migrate, app
- 45 tests passing; mypy clean
18 lines
695 B
Python
18 lines
695 B
Python
"""Test package init.
|
|
|
|
Sets environment overrides BEFORE any test module imports
|
|
:mod:`scopa.app` (which evaluates :data:`scopa.config.settings`
|
|
at import time). Works under both ``python -m unittest discover`` and
|
|
``pytest``; conftest.py mirrors this for pytest-only collection.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
os.environ.setdefault("DATABASE_URL", "sqlite://:memory:")
|
|
os.environ.setdefault("OIDC_ISSUER", "http://localhost:8180/scopa")
|
|
os.environ.setdefault("OIDC_CLIENT_ID", "scopa")
|
|
os.environ.setdefault("OIDC_REDIRECT_URI", "http://localhost:8080/auth/callback")
|
|
# Unset REDIS_URL: sessions and live games use the in-memory fallbacks.
|
|
os.environ.pop("REDIS_URL", None)
|