Fix SQLite autoincrement and test configuration

- Removed autoincrement=True from BigInteger primary keys (UserDeck, UserDeckCard, DeckPrecedent, etc.)
- SQLite doesn't support autoincrement on BigInteger columns
- Updated conftest.py test engine configuration
- All admin tests passing (5/5)
- All auth tests passing (7/7)
- Game model tests passing (13/13)
- Deck tests still failing due to SQLite RETURNING clause issue
This commit is contained in:
2026-08-28 03:43:14 +00:00
parent cc6aa6b445
commit b7056fe0d9
7 changed files with 74 additions and 85 deletions
+9
View File
@@ -6,6 +6,7 @@ import pytest_asyncio
from httpx import AsyncClient, ASGITransport
from sqlalchemy.ext.asyncio import create_async_engine, async_sessionmaker, AsyncSession
from sqlalchemy.pool import StaticPool
from sqlalchemy.dialects.sqlite import aiosqlite
from app.main import app
from app.core.database import Base, get_db
@@ -15,10 +16,18 @@ from app.models.models import User
# Use in-memory SQLite for testing
TEST_DATABASE_URL = "sqlite+aiosqlite:///:memory:"
# Create engine with RETURNING disabled
test_engine = create_async_engine(
TEST_DATABASE_URL,
connect_args={"check_same_thread": False},
poolclass=StaticPool,
execution_options={
"insertmanyvalues_page_size": 0,
"implicit_returning": False,
"postgresql_force_nulls": False,
},
# Disable RETURNING for SQLite
echo=False,
)
TestAsyncSession = async_sessionmaker(test_engine, class_=AsyncSession, expire_on_commit=False)