File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -165,8 +165,14 @@ async def test_db_pool(postgres_container):
165165 """Asyncpg pool connected to the ephemeral Postgres.
166166
167167 Creates schema directly to avoid cross-loop pool reuse with the app.
168+ Clears global pools dict before creating a new pool to prevent connection exhaustion.
168169 """
169170 import asyncpg # local import to avoid import at collection when skipped
171+ from cairo_coder .db import session as db_session
172+
173+ # Clear any lingering pools from the global dict to prevent connection exhaustion
174+ # during long test runs
175+ await db_session .close_pool ()
170176
171177 raw_dsn = postgres_container .get_connection_url ()
172178 # Convert SQLAlchemy-style DSN to asyncpg-compatible DSN
You can’t perform that action at this time.
0 commit comments