fix(ci): handle event loop closed during test teardown
Catch RuntimeError in admin_session teardown cleanup — the event loop may be closed when the last test's fixtures are torn down. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -182,9 +182,12 @@ async def admin_session(admin_engine) -> AsyncGenerator[AsyncSession, None]:
|
||||
try:
|
||||
yield session
|
||||
finally:
|
||||
if existing_tables:
|
||||
await session.execute(text(f"TRUNCATE {tables_csv} CASCADE"))
|
||||
await session.commit()
|
||||
try:
|
||||
if existing_tables:
|
||||
await session.execute(text(f"TRUNCATE {tables_csv} CASCADE"))
|
||||
await session.commit()
|
||||
except RuntimeError:
|
||||
pass # Event loop may be closed during final teardown
|
||||
await session.close()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user