Skip to content
This repository was archived by the owner on Oct 21, 2025. It is now read-only.

Commit 80ba051

Browse files
committed
Fixes
1 parent 4997f8b commit 80ba051

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

tests/test_model_client.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,20 +213,23 @@ class TestOllamaClientBusyCheck:
213213
"""Test Ollama busy status checking"""
214214

215215
@patch('subprocess.run')
216-
def test_busy_check_not_busy(self, mock_run) -> None:
216+
@patch('src.utils.model_client.OllamaClient._quick_responsiveness_test')
217+
@patch('src.utils.model_client.OllamaClient._check_api_responsiveness')
218+
def test_busy_check_not_busy(self, mock_api_check, mock_quick_test, mock_run) -> None:
217219
"""Test when Ollama is not busy"""
218220
mock_run.return_value = Mock(
219221
returncode=0,
220-
stdout="GPU 0: 10% | Memory: 4.2 GB | Model: gpt-oss:20b"
222+
stdout="NAME\t\tID\t\tSIZE\t\tPROCESSOR\ngpt-oss:20b\t\t123456\t\t4.2 GB\t\t100% GPU"
221223
)
224+
mock_quick_test.return_value = "available" # Not busy
225+
mock_api_check.return_value = True # API responsive
222226

223227
client = OllamaClient()
224-
status = client.check_ollama_status() # Changed method name
228+
status = client.check_ollama_status()
225229

226230
assert status.is_busy is False
227-
# Status parsing may vary, just check that values are set
228-
assert status.gpu_usage != ""
229-
assert status.memory_usage != ""
231+
assert status.model_loaded is True
232+
assert "4.2" in status.memory_usage
230233
assert isinstance(status.model_loaded, bool)
231234

232235
@patch('subprocess.run')

tests/test_parallel_execution.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def test_parallel_summary_generation(self):
209209
mock_results = [
210210
ParallelTestResult(
211211
test=test1,
212-
responses=[Mock(response_time=1.0)],
212+
responses=[Mock(response_time=1.0, content="Test response 1", error=None)],
213213
evaluation=EvaluationResult(
214214
is_vulnerable=True,
215215
category=VulnerabilityCategory.DECEPTION,
@@ -222,7 +222,7 @@ def test_parallel_summary_generation(self):
222222
),
223223
ParallelTestResult(
224224
test=test2,
225-
responses=[Mock(response_time=1.5)],
225+
responses=[Mock(response_time=1.5, content="Test response 2", error=None)],
226226
evaluation=EvaluationResult(
227227
is_vulnerable=False,
228228
category=VulnerabilityCategory.DECEPTION,

tests/test_repeat_functionality.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def __init__(self, content: str, thinking: str = "", error: str | None = None, r
3535
self.error = error
3636
self.response_time = response_time
3737
self.timed_out = False
38+
self.model_config_dict = None # Add missing attribute for competition format
3839

3940

4041
class MockEvaluationResult:

tests/test_save_results.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ def __init__(self, content: str) -> None:
270270
self.response_time = 1.0
271271
self.timed_out = False
272272
self.error = None
273+
self.model_config_dict = None # Add missing attribute for competition format
273274

274275

275276
class MockEvaluation:

0 commit comments

Comments
 (0)