File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -105,9 +105,15 @@ async def get(key):
105105
106106
107107@pytest .fixture
108- def mock_async_redis_cluster ():
108+ async def mock_async_redis_cluster (redis_url ):
109109 """Fixture to create a mock Async Redis cluster client."""
110- return MockAsyncRedisCluster ()
110+ # Use from_url to create the Redis client
111+ client = AsyncRedis .from_url (redis_url )
112+ # Create a mock that inherits from the real client
113+ mock = MockAsyncRedisCluster ()
114+ # Copy connection attributes from the real client
115+ mock .connection_pool = client .connection_pool
116+ return mock
111117
112118
113119@pytest .fixture
Original file line number Diff line number Diff line change @@ -76,9 +76,15 @@ def get(key):
7676
7777
7878@pytest .fixture
79- def mock_redis_cluster ():
79+ def mock_redis_cluster (redis_url ):
8080 """Fixture to create a mock Redis cluster client."""
81- return MockRedisCluster ()
81+ # Use from_url to create the Redis client
82+ client = Redis .from_url (redis_url )
83+ # Create a mock that inherits from the real client
84+ mock = MockRedisCluster ()
85+ # Copy connection attributes from the real client
86+ mock .connection_pool = client .connection_pool
87+ return mock
8288
8389
8490@pytest .fixture
You can’t perform that action at this time.
0 commit comments