Stabilize staff concurrency and premium emoji; enable verified Drone deployment
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2026-09-13 19:48:41 +09:00
parent 733298bf06
commit cb35bb12e3
86 changed files with 2993 additions and 2455 deletions

27
tests/conftest.py Normal file
View File

@@ -0,0 +1,27 @@
"""All tests use disposable databases and a synthetic Telegram token."""
import os
import tempfile
from pathlib import Path
import pytest_asyncio
_temporary = tempfile.TemporaryDirectory(prefix="lottery-tests-")
os.environ["DATABASE_URL"] = os.getenv("TEST_DATABASE_URL") or (
"sqlite+aiosqlite:///" + (Path(_temporary.name) / "test.db").as_posix()
)
os.environ["BOT_TOKEN"] = "123456:TEST_TOKEN_FOR_ISOLATED_TESTS"
os.environ["ADMIN_IDS"] = "900001"
os.environ["CASHIER_IDS"] = "900002"
os.environ["REDIS_URL"] = ""
from src.core.database import Base, engine, async_session_maker
from src.core import models
@pytest_asyncio.fixture(autouse=True)
async def database():
async with engine.begin() as connection:
await connection.run_sync(Base.metadata.drop_all)
await connection.run_sync(Base.metadata.create_all)
yield async_session_maker
await engine.dispose()