From 3c35c46f96fc03f4395d8cb69397865fd45d4932 Mon Sep 17 00:00:00 2001 From: dajiaohuang Date: Fri, 4 Sep 2026 14:47:14 +0800 Subject: [PATCH] test: isolate redis py4 import fallback --- tests/test_litellm/caching/test_valkey_semantic_cache.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_litellm/caching/test_valkey_semantic_cache.py b/tests/test_litellm/caching/test_valkey_semantic_cache.py index f128795039d..45564199467 100644 --- a/tests/test_litellm/caching/test_valkey_semantic_cache.py +++ b/tests/test_litellm/caching/test_valkey_semantic_cache.py @@ -543,12 +543,18 @@ def test_valkey_cache_supports_redis_py_4_index_module(): import sys import types - from redis.commands.search.index_definition import IndexDefinition, IndexType + class IndexDefinition: + def __init__(self, *args, **kwargs): + pass + + class IndexType: + pass legacy = types.ModuleType("redis.commands.search.indexDefinition") legacy.IndexDefinition = IndexDefinition legacy.IndexType = IndexType sys.modules[legacy.__name__] = legacy + original_import = builtins.__import__ def compatibility_import(name, *args, **kwargs):