LichessStatTgWeb/tests/bot/_env.py
vrubelroman a7571f13c1
All checks were successful
CI/CD Pipeline / build-and-deploy (push) Successful in 16s
v1.5.1: not-found players paused, tests in repo + CI, log-based daily summary, docs pruned
- players absent from two consecutive bulk answers (deleted/renamed on Lichess) are paused
  like closed accounts with their own notice; ❓ mark; stats service answers 404 instead
  of "0 games" for unknown users
- /getgamers table stays unmarked, a legend line under it lists closed / not-found players
- daily SUMMARY is computed from events.log (survives restarts); lichess_429 comes from the
  stats service /health, which now exposes lichess_429_24h / lichess_429_total
- admin /status reads its numbers through Database.get_admin_stats
- tests/: 36 bot + 15 service unittest cases, run_tests.sh runs them inside the real images,
  CI runs them after the build and before pushing/deploying
- docs: USER_GUIDE/about/API_DOCUMENTATION rewritten for the current code, ARCHITECTURE.md and
  two sub-READMEs removed, 7 obsolete helper scripts removed, CURRENT_STATE updated
- .claude/agents/designer.md: Telegram-aware designer role

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-21 02:48:00 +00:00

14 lines
686 B
Python

"""
Shared test environment for the bot suite. Imported FIRST by every test module:
config.py resolves DATABASE_PATH at import time, so the variables must be set
before anything from the bot package is imported. run_tests.sh sets them too;
this only makes a bare `python -m unittest` inside the image work as well.
"""
import os
import tempfile
TEMP_DIR = tempfile.mkdtemp(prefix="lichess-tests-")
os.environ.setdefault("DATABASE_PATH", os.path.join(TEMP_DIR, "lichess_bot.db"))
os.environ.setdefault("TELEGRAM_BOT_TOKEN", "123456:ABCDEF")
os.environ.setdefault("ADMINPANEL_TELEGRAM_BOT_TOKEN", "123456:ABCDEF")
os.makedirs(os.path.dirname(os.environ["DATABASE_PATH"]), exist_ok=True)