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:
|
try:
|
||||||
yield session
|
yield session
|
||||||
finally:
|
finally:
|
||||||
if existing_tables:
|
try:
|
||||||
await session.execute(text(f"TRUNCATE {tables_csv} CASCADE"))
|
if existing_tables:
|
||||||
await session.commit()
|
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()
|
await session.close()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user