mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
test: refactor testing to handle routing correctly
This commit is contained in:
parent
cf1b5b6590
commit
e1860c3d9d
3 changed files with 45 additions and 74 deletions
|
@ -20,7 +20,8 @@ from litellm.caching.redis_cache import RedisCache
|
|||
|
||||
@pytest.mark.parametrize("namespace", [None, "test"])
|
||||
@pytest.mark.asyncio
|
||||
async def test_redis_cache_async_increment(namespace):
|
||||
async def test_redis_cache_async_increment(namespace, monkeypatch):
|
||||
monkeypatch.setenv("REDIS_HOST", "https://my-test-host")
|
||||
redis_cache = RedisCache(namespace=namespace)
|
||||
# Create an AsyncMock for the Redis client
|
||||
mock_redis_instance = AsyncMock()
|
||||
|
@ -46,7 +47,8 @@ async def test_redis_cache_async_increment(namespace):
|
|||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_redis_client_init_with_socket_timeout():
|
||||
async def test_redis_client_init_with_socket_timeout(monkeypatch):
|
||||
monkeypatch.setenv("REDIS_HOST", "my-fake-host")
|
||||
redis_cache = RedisCache(socket_timeout=1.0)
|
||||
assert redis_cache.redis_kwargs["socket_timeout"] == 1.0
|
||||
client = redis_cache.init_async_client()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue