Skip to content

Commit 06f3746

Browse files
committed
fix test
1 parent 4d5823f commit 06f3746

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/integrations/huggingface_hub/test_huggingface_hub.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22
import pytest
33
import responses
44

5-
import huggingface_hub
65
from huggingface_hub import InferenceClient
76

87
import sentry_sdk
98
from sentry_sdk.utils import package_version
109

1110
from typing import TYPE_CHECKING
1211

12+
try:
13+
from huggingface_hub.utils._errors import HfHubHTTPError
14+
except ImportError:
15+
from huggingface_hub.errors import HfHubHTTPError
16+
17+
1318
if TYPE_CHECKING:
1419
from typing import Any
1520

@@ -465,7 +470,7 @@ def test_chat_completion_api_error(
465470
client = InferenceClient(model="test-model")
466471

467472
with sentry_sdk.start_transaction(name="test"):
468-
with pytest.raises(huggingface_hub.errors.HfHubHTTPError):
473+
with pytest.raises(HfHubHTTPError):
469474
client.chat_completion(
470475
messages=[{"role": "user", "content": "Hello!"}],
471476
)

0 commit comments

Comments
 (0)