Skip to content

Commit 2b44c1c

Browse files
committed
Linters
1 parent ad94c9e commit 2b44c1c

16 files changed

+1041
-821
lines changed

src/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.3.0"
1+
__version__ = "0.3.0"

tests/conftest.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
Pytest configuration and fixtures for Redis MCP Server tests.
33
"""
44

5-
import pytest
65
from unittest.mock import Mock, patch
6+
7+
import pytest
78
import redis
8-
from redis.exceptions import RedisError, ConnectionError, TimeoutError
9+
from redis.exceptions import ConnectionError, RedisError, TimeoutError
910

1011

1112
@pytest.fixture
@@ -25,7 +26,9 @@ def mock_redis_cluster():
2526
@pytest.fixture
2627
def mock_redis_connection_manager():
2728
"""Mock the RedisConnectionManager to return a mock Redis connection."""
28-
with patch('src.common.connection.RedisConnectionManager.get_connection') as mock_get_conn:
29+
with patch(
30+
"src.common.connection.RedisConnectionManager.get_connection"
31+
) as mock_get_conn:
2932
mock_redis = Mock(spec=redis.Redis)
3033
mock_get_conn.return_value = mock_redis
3134
yield mock_redis
@@ -75,7 +78,7 @@ def sample_json_data():
7578
"name": "John Doe",
7679
"age": 30,
7780
"city": "New York",
78-
"hobbies": ["reading", "swimming"]
81+
"hobbies": ["reading", "swimming"],
7982
}
8083

8184

@@ -87,14 +90,17 @@ def redis_error_scenarios():
8790
"timeout_error": TimeoutError("Operation timed out"),
8891
"generic_error": RedisError("Generic Redis error"),
8992
"auth_error": RedisError("NOAUTH Authentication required"),
90-
"wrong_type": RedisError("WRONGTYPE Operation against a key holding the wrong kind of value"),
93+
"wrong_type": RedisError(
94+
"WRONGTYPE Operation against a key holding the wrong kind of value"
95+
),
9196
}
9297

9398

9499
@pytest.fixture(autouse=True)
95100
def reset_connection_manager():
96101
"""Reset the RedisConnectionManager singleton before each test."""
97102
from src.common.connection import RedisConnectionManager
103+
98104
RedisConnectionManager._instance = None
99105
yield
100106
RedisConnectionManager._instance = None
@@ -103,15 +109,15 @@ def reset_connection_manager():
103109
@pytest.fixture
104110
def mock_numpy_array():
105111
"""Mock numpy array for vector testing."""
106-
with patch('numpy.array') as mock_array:
107-
mock_array.return_value.tobytes.return_value = b'mock_binary_data'
112+
with patch("numpy.array") as mock_array:
113+
mock_array.return_value.tobytes.return_value = b"mock_binary_data"
108114
yield mock_array
109115

110116

111117
@pytest.fixture
112118
def mock_numpy_frombuffer():
113119
"""Mock numpy frombuffer for vector testing."""
114-
with patch('numpy.frombuffer') as mock_frombuffer:
120+
with patch("numpy.frombuffer") as mock_frombuffer:
115121
mock_frombuffer.return_value.tolist.return_value = [0.1, 0.2, 0.3]
116122
yield mock_frombuffer
117123

@@ -121,6 +127,7 @@ def mock_numpy_frombuffer():
121127
def event_loop():
122128
"""Create an event loop for async tests."""
123129
import asyncio
130+
124131
loop = asyncio.new_event_loop()
125132
yield loop
126133
loop.close()

0 commit comments

Comments
 (0)