Skip to content

Commit 2f9739d

Browse files
committed
sonarcloud fix
1 parent caec4c3 commit 2f9739d

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

tests/unit/test_memory_utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def test_non_memory_error_reraises_same_object(self):
222222

223223
def test_memory_error_triggers_cleanup_and_returns_retry_result(self):
224224
"""A BFCArena error calls cleanup once and returns the retry result."""
225-
err = Exception("BFCArena failed")
225+
err = RuntimeError("BFCArena failed")
226226
cleanup = Mock()
227227
retry = Mock(return_value="retried")
228228

@@ -236,7 +236,7 @@ def test_memory_error_triggers_cleanup_and_returns_retry_result(self):
236236

237237
def test_cpu_fallback_returns_result_session_provider_tuple(self):
238238
"""CPU fallback returns (result, new_session, provider)."""
239-
err = Exception("BFCArena failed")
239+
err = RuntimeError("BFCArena failed")
240240
session_mock = MagicMock()
241241
creator = Mock(return_value=(session_mock, "CPUExecutionProvider"))
242242
retry = Mock(return_value="r")
@@ -255,7 +255,7 @@ def test_cpu_fallback_returns_result_session_provider_tuple(self):
255255

256256
def test_retry_failure_propagates_retry_exception(self):
257257
"""If the retry itself fails, that exception propagates."""
258-
err = Exception("Failed to allocate memory for requested buffer")
258+
err = RuntimeError("Failed to allocate memory for requested buffer")
259259
retry_err = RuntimeError("still failing")
260260
retry = Mock(side_effect=retry_err)
261261

@@ -266,9 +266,9 @@ def test_retry_failure_propagates_retry_exception(self):
266266

267267
def test_memory_error_without_retry_or_fallback_reraises_original(self):
268268
"""A memory error with no retry and no fallback re-raises the original."""
269-
err = Exception("out of memory")
269+
err = RuntimeError("out of memory")
270270

271-
with pytest.raises(Exception) as excinfo:
271+
with pytest.raises(RuntimeError) as excinfo:
272272
handle_onnx_memory_error(err, "test context")
273273

274274
assert excinfo.value is err

tests/unit/test_radius_walk_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TestAvoidTripleAdjacent:
1919
def test_triple_swapped_with_later_different_artist(self):
2020
ids = ['a1', 'a2', 'a3', 'b1']
2121
id_to_author = {'a1': 'A', 'a2': 'A', 'a3': 'A', 'b1': 'B'}
22-
original = list(ids)
22+
original = ids.copy()
2323

2424
result = avoid_triple_adjacent(ids, id_to_author)
2525

tests/unit/test_taskqueue.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ def test_redis_socket_options_tls_url_keeps_keepalive():
3636

3737
def test_build_embedded_redis_argv_binary_flags_and_url():
3838
argv, url = taskqueue.build_embedded_redis_argv(
39-
'/usr/bin/redis-server', '/tmp/r.sock', '/data'
39+
'/usr/bin/redis-server', '/var/lib/audiomuse/redis.sock', '/data'
4040
)
4141
assert argv[0] == '/usr/bin/redis-server'
4242
for flag, value in (
43-
('--unixsocket', '/tmp/r.sock'),
43+
('--unixsocket', '/var/lib/audiomuse/redis.sock'),
4444
('--unixsocketperm', '700'),
4545
('--port', '0'),
4646
('--save', ''),
@@ -49,7 +49,7 @@ def test_build_embedded_redis_argv_binary_flags_and_url():
4949
):
5050
idx = argv.index(flag)
5151
assert argv[idx + 1] == value
52-
assert url == 'unix:///tmp/r.sock?db=0'
52+
assert url == 'unix:///var/lib/audiomuse/redis.sock?db=0'
5353

5454

5555
def test_redis_conn_connection_kwargs():

0 commit comments

Comments
 (0)