From cffccf88173a331e6179974de6f370c9451b8e4a Mon Sep 17 00:00:00 2001 From: YizhenJia Date: Fri, 7 Aug 2026 10:42:38 +0800 Subject: [PATCH] [test] Fix offline AutoModel unit test --- tests/models/test_auto_model.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/models/test_auto_model.py b/tests/models/test_auto_model.py index a8abda559..4b402467b 100644 --- a/tests/models/test_auto_model.py +++ b/tests/models/test_auto_model.py @@ -1,4 +1,5 @@ import unittest +from unittest.mock import patch from lmflow.args import ModelArguments from lmflow.models.auto_model import AutoModel @@ -12,8 +13,11 @@ class AutoModelTest(unittest.TestCase): def test_get_decoder_model(self): model_args = ModelArguments(arch_type="decoder_only", model_name_or_path=MODEL_NAME) - model = AutoModel.get_model(model_args) - self.assertTrue(isinstance(model, HFDecoderModel)) + with patch.object(HFDecoderModel, "__init__", return_value=None) as model_init: + model = AutoModel.get_model(model_args) + + self.assertIsInstance(model, HFDecoderModel) + model_init.assert_called_once_with(model_args) # This unit test is commented out since the encoder decoder model has not been fully implemented """