Skip to content

Commit e24fc6b

Browse files
committed
Close async HTTP clients in tests
Add explicit teardown to close async HTTP clients to prevent unclosed connector warnings and resource leaks. Updated fixtures in tests/test_index_management.py (async_index_client), tests/test_ink_services_async.py (export_service), and tests/test_queue_management.py (async_queue_client) to await client.close(), user_management.close(), and export_svc.close() where appropriate.
1 parent fb0f449 commit e24fc6b

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

tests/test_index_management.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ async def async_index_client():
181181
)
182182
except Exception as e:
183183
logger.error(f"Async cleanup error: {e}")
184+
finally:
185+
# Close async HTTP clients to prevent unclosed connector warnings
186+
await client.close()
187+
await user_management.close()
184188

185189

186190
# ================================================================================================

tests/test_ink_services_async.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,10 @@ async def export_service():
251251
except Exception as e:
252252
logger.error(f"Error during user cleanup: {e}")
253253

254+
# Close async HTTP clients to prevent unclosed connector warnings
255+
await export_svc.close()
256+
await user_management.close()
257+
254258

255259
@pytest.fixture(scope="module")
256260
def output_path() -> Path:

tests/test_queue_management.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ async def async_queue_client():
110110

111111
yield client
112112

113+
# Teardown: close async HTTP clients to prevent unclosed connector warnings
114+
await client.close()
115+
await user_management.close()
116+
113117

114118
# ================================================================================================
115119
# Sync tests

0 commit comments

Comments
 (0)