test: update test suite for SQLAlchemy 2.0 migration

- Add session fixture for async session management
- Update all test files to use session parameter
- Convert Core-style queries to ORM-style in tests
- Fix controller calls to include session parameter
- Remove obsolete get_database() references

Test progress: 108/195 tests passing
This commit is contained in:
2025-09-18 12:35:51 -06:00
parent 06639d4d8f
commit 45d1608950
8 changed files with 163 additions and 131 deletions

View File

@@ -53,7 +53,8 @@ def appserver(tmpdir, setup_database, celery_session_app, celery_session_worker)
import threading
from reflector.app import app
from reflector.db import get_database
# Database connection handled by SQLAlchemy engine
from reflector.settings import settings
DATA_DIR = settings.DATA_DIR
@@ -77,13 +78,8 @@ def appserver(tmpdir, setup_database, celery_session_app, celery_session_worker)
server_instance = Server(config)
async def start_server():
# Initialize database connection in this event loop
database = get_database()
await database.connect()
try:
await server_instance.serve()
finally:
await database.disconnect()
# Database connections managed by SQLAlchemy engine
await server_instance.serve()
# Signal that server is starting
server_started.set()