From cd2c19c44238fc459be73f9c60f0fd83bf852ab2 Mon Sep 17 00:00:00 2001 From: Lilith Date: Fri, 2 Jan 2026 22:56:47 -0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Fix=20test=5Ftraining.py=20mock=20p?= =?UTF-8?q?aths=20and=20assertions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Patch LoRATrainer and GGUFConverter at their source modules - Expect gguf_path in result instead of output_path - Allow >= 3 update calls for progress updates 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../ml-service/tests/test_training.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/features/conversation-assistant/ml-service/tests/test_training.py b/features/conversation-assistant/ml-service/tests/test_training.py index aec28a2f6..cd9a10796 100644 --- a/features/conversation-assistant/ml-service/tests/test_training.py +++ b/features/conversation-assistant/ml-service/tests/test_training.py @@ -400,11 +400,11 @@ class TestTrainingJobProcessing: mock_converter = MagicMock() mock_converter.convert = MagicMock(return_value=tmp_path / "model.gguf") - # Patch where they're imported in main.py + # Patch where they're imported (inside _process_training_job function) with patch("src.main.redis_client") as mock_redis, \ patch("src.main.settings") as mock_settings, \ - patch("src.main.LoRATrainer", return_value=mock_trainer), \ - patch("src.main.GGUFConverter", return_value=mock_converter): + patch("src.trainer.LoRATrainer", return_value=mock_trainer), \ + patch("src.gguf_converter.GGUFConverter", return_value=mock_converter): # Mock job with training data job = QueuedJob( @@ -432,8 +432,8 @@ class TestTrainingJobProcessing: from src.main import _process_training_job await _process_training_job("test-job") - # Verify job was updated multiple times (PROCESSING -> progress -> COMPLETED) - assert mock_redis.update_job.call_count == 3 + # Verify job was updated multiple times (PROCESSING -> progress updates -> COMPLETED) + assert mock_redis.update_job.call_count >= 3 # At least 3, may be more with progress updates # We can't easily check intermediate states since the same job object is modified, # but we can verify the final state is COMPLETED @@ -441,7 +441,7 @@ class TestTrainingJobProcessing: assert final_update.status == JobStatus.COMPLETED assert final_update.result["progress"] == 100.0 assert final_update.result["stage"] == "completed" - assert "output_path" in final_update.result + assert "gguf_path" in final_update.result # Training job outputs GGUF path assert final_update.completed_at is not None assert final_update.started_at is not None