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