Fix deck test failures - SQLite RETURNING clause and async serialization

- Fixed conftest.py: Use execution_options for implicit_returning (SQLAlchemy 2.0)
- Fixed models.py: Changed UserDeck.updated_at onupdate from func.now() to datetime.now
- All 5 deck tests now pass
- Full suite: 26 passed, 2 failed (pre-existing game model issues)
This commit is contained in:
2026-10-18 03:40:13 +00:00
parent b7056fe0d9
commit f7d6bfd974
4 changed files with 28 additions and 32 deletions
+2 -8
View File
@@ -16,18 +16,12 @@ from app.models.models import User
# Use in-memory SQLite for testing
TEST_DATABASE_URL = "sqlite+aiosqlite:///:memory:"
# Create engine with RETURNING disabled
# Create engine with RETURNING disabled for SQLite
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,
execution_options={"implicit_returning": False},
)
TestAsyncSession = async_sessionmaker(test_engine, class_=AsyncSession, expire_on_commit=False)