@@ -192,38 +192,38 @@ def __init__(self):
192
192
self .closed = False
193
193
194
194
@pytest .mark .asyncio
195
- async def test_create_aiohttp_transport_with_existing_session ():
196
- """Test that _create_aiohttp_transport reuses existing session when provided"""
195
+ async def test_create_aiohttp_transport_with_shared_session ():
196
+ """Test that _create_aiohttp_transport reuses shared session when provided"""
197
197
from litellm .llms .custom_httpx .http_handler import AsyncHTTPHandler
198
198
199
- # Create a mock existing session that's not callable
199
+ # Create a mock shared session that's not callable
200
200
mock_session = MockClientSession ()
201
201
202
- # Test with existing session
202
+ # Test with shared session
203
203
transport = AsyncHTTPHandler ._create_aiohttp_transport (
204
- existing_session = mock_session # type: ignore
204
+ shared_session = mock_session # type: ignore
205
205
)
206
206
207
- # Verify the transport uses the existing session directly
207
+ # Verify the transport uses the shared session directly
208
208
assert transport .client is mock_session
209
209
assert not callable (transport .client ) # Should not be callable
210
210
211
211
212
212
@pytest .mark .asyncio
213
- async def test_create_aiohttp_transport_without_existing_session ():
213
+ async def test_create_aiohttp_transport_without_shared_session ():
214
214
"""Test that _create_aiohttp_transport creates new session when none provided"""
215
215
from litellm .llms .custom_httpx .http_handler import AsyncHTTPHandler
216
216
217
- # Test without existing session
218
- transport = AsyncHTTPHandler ._create_aiohttp_transport (existing_session = None )
217
+ # Test without shared session
218
+ transport = AsyncHTTPHandler ._create_aiohttp_transport (shared_session = None )
219
219
220
220
# Verify the transport uses a lambda function (for backward compatibility)
221
221
assert callable (transport .client ) # Should be a lambda function
222
222
223
223
224
224
@pytest .mark .asyncio
225
225
async def test_create_aiohttp_transport_with_closed_session ():
226
- """Test that _create_aiohttp_transport creates new session when existing session is closed"""
226
+ """Test that _create_aiohttp_transport creates new session when shared session is closed"""
227
227
from litellm .llms .custom_httpx .http_handler import AsyncHTTPHandler
228
228
229
229
# Create a mock closed session
@@ -232,42 +232,42 @@ async def test_create_aiohttp_transport_with_closed_session():
232
232
233
233
# Test with closed session
234
234
transport = AsyncHTTPHandler ._create_aiohttp_transport (
235
- existing_session = mock_session # type: ignore
235
+ shared_session = mock_session # type: ignore
236
236
)
237
237
238
238
# Verify the transport creates a new session (lambda function)
239
239
assert callable (transport .client ) # Should be a lambda function
240
240
241
241
242
242
@pytest .mark .asyncio
243
- async def test_async_handler_with_existing_session ():
244
- """Test AsyncHTTPHandler initialization with existing session"""
243
+ async def test_async_handler_with_shared_session ():
244
+ """Test AsyncHTTPHandler initialization with shared session"""
245
245
from litellm .llms .custom_httpx .http_handler import AsyncHTTPHandler
246
246
247
- # Create a mock existing session
247
+ # Create a mock shared session
248
248
mock_session = MockClientSession ()
249
249
250
- # Create handler with existing session
251
- handler = AsyncHTTPHandler (existing_session = mock_session ) # type: ignore
250
+ # Create handler with shared session
251
+ handler = AsyncHTTPHandler (shared_session = mock_session ) # type: ignore
252
252
253
253
# Verify the handler was created successfully
254
254
assert handler is not None
255
255
assert handler .client is not None
256
256
257
257
258
258
@pytest .mark .asyncio
259
- async def test_get_async_httpx_client_with_existing_session ():
260
- """Test get_async_httpx_client with existing session"""
259
+ async def test_get_async_httpx_client_with_shared_session ():
260
+ """Test get_async_httpx_client with shared session"""
261
261
from litellm .llms .custom_httpx .http_handler import get_async_httpx_client
262
262
from litellm .types .utils import LlmProviders
263
263
264
- # Create a mock existing session
264
+ # Create a mock shared session
265
265
mock_session = MockClientSession ()
266
266
267
- # Test with existing session
267
+ # Test with shared session
268
268
client = get_async_httpx_client (
269
269
llm_provider = LlmProviders .ANTHROPIC ,
270
- existing_session = mock_session # type: ignore
270
+ shared_session = mock_session # type: ignore
271
271
)
272
272
273
273
# Verify the client was created successfully
@@ -276,15 +276,15 @@ async def test_get_async_httpx_client_with_existing_session():
276
276
277
277
278
278
@pytest .mark .asyncio
279
- async def test_get_async_httpx_client_without_existing_session ():
280
- """Test get_async_httpx_client without existing session (backward compatibility)"""
279
+ async def test_get_async_httpx_client_without_shared_session ():
280
+ """Test get_async_httpx_client without shared session (backward compatibility)"""
281
281
from litellm .llms .custom_httpx .http_handler import get_async_httpx_client
282
282
from litellm .types .utils import LlmProviders
283
283
284
- # Test without existing session
284
+ # Test without shared session
285
285
client = get_async_httpx_client (
286
286
llm_provider = LlmProviders .ANTHROPIC ,
287
- existing_session = None
287
+ shared_session = None
288
288
)
289
289
290
290
# Verify the client was created successfully
@@ -297,19 +297,19 @@ async def test_session_reuse_chain():
297
297
"""Test that session is properly passed through the entire call chain"""
298
298
from litellm .llms .custom_httpx .http_handler import AsyncHTTPHandler
299
299
300
- # Create a mock existing session
300
+ # Create a mock shared session
301
301
mock_session = MockClientSession ()
302
302
303
303
# Test the entire chain
304
304
transport = AsyncHTTPHandler ._create_async_transport (
305
- existing_session = mock_session # type: ignore
305
+ shared_session = mock_session # type: ignore
306
306
)
307
307
308
308
# Verify the transport was created
309
309
assert transport is not None
310
310
311
311
# Test AsyncHTTPHandler creation
312
- handler = AsyncHTTPHandler (existing_session = mock_session ) # type: ignore
312
+ handler = AsyncHTTPHandler (shared_session = mock_session ) # type: ignore
313
313
assert handler is not None
314
314
315
315
@@ -359,12 +359,12 @@ async def test_session_reuse_integration():
359
359
# Create two clients with the same session
360
360
client1 = get_async_httpx_client (
361
361
llm_provider = LlmProviders .ANTHROPIC ,
362
- existing_session = mock_session # type: ignore
362
+ shared_session = mock_session # type: ignore
363
363
)
364
364
365
365
client2 = get_async_httpx_client (
366
366
llm_provider = LlmProviders .OPENAI ,
367
- existing_session = mock_session # type: ignore
367
+ shared_session = mock_session # type: ignore
368
368
)
369
369
370
370
# Both clients should be created successfully
@@ -386,16 +386,16 @@ async def test_session_validation():
386
386
from litellm .llms .custom_httpx .http_handler import AsyncHTTPHandler
387
387
388
388
# Test with None session
389
- transport1 = AsyncHTTPHandler ._create_aiohttp_transport (existing_session = None )
389
+ transport1 = AsyncHTTPHandler ._create_aiohttp_transport (shared_session = None )
390
390
assert callable (transport1 .client ) # Should create lambda
391
391
392
392
# Test with closed session
393
393
mock_closed_session = MockClientSession ()
394
394
mock_closed_session .closed = True
395
- transport2 = AsyncHTTPHandler ._create_aiohttp_transport (existing_session = mock_closed_session ) # type: ignore
395
+ transport2 = AsyncHTTPHandler ._create_aiohttp_transport (shared_session = mock_closed_session ) # type: ignore
396
396
assert callable (transport2 .client ) # Should create lambda
397
397
398
398
# Test with valid session
399
399
mock_valid_session = MockClientSession ()
400
- transport3 = AsyncHTTPHandler ._create_aiohttp_transport (existing_session = mock_valid_session ) # type: ignore
400
+ transport3 = AsyncHTTPHandler ._create_aiohttp_transport (shared_session = mock_valid_session ) # type: ignore
401
401
assert transport3 .client is mock_valid_session # Should reuse session
0 commit comments