Skip to content

Commit 3bc91cb

Browse files
fix: catch specific exceptions instead of generic Exception (fixes BLE001 lint error)
1 parent 0a7e86f commit 3bc91cb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

libs/langchain/tests/unit_tests/chat_models/test_base.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,12 @@ def test_init_chat_model_huggingface() -> None:
101101
)
102102
assert isinstance(llm2, ChatHuggingFace)
103103
assert llm2.llm is not None
104-
except Exception as e:
104+
except (
105+
ImportError,
106+
OSError,
107+
RuntimeError,
108+
ValueError,
109+
) as e:
105110
# If model download fails in CI, skip the test rather than failing
106111
# The important part is that the code path doesn't raise ValidationError
107112
# about missing 'llm' field, which was the original bug

0 commit comments

Comments
 (0)