Skip to content

Commit add8b6f

Browse files
authored
Fix huggingface_hub CI tests. (#4619)
HuggingFace has changed its default model used in `InferenceClient` and the new model breaks our CI. Change to use a non-existent model.
1 parent fe3ccb8 commit add8b6f

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

tests/integrations/huggingface_hub/test_huggingface_hub.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
def mock_client_post(client, post_mock):
1616
# huggingface-hub==0.28.0 deprecates the `post` method
1717
# so patch `_inner_post` instead
18-
client.post = post_mock
19-
client._inner_post = post_mock
18+
if hasattr(client, "post"):
19+
client.post = post_mock
20+
if hasattr(client, "_inner_post"):
21+
client._inner_post = post_mock
2022

2123

2224
@pytest.mark.parametrize(
@@ -33,7 +35,8 @@ def test_nonstreaming_chat_completion(
3335
)
3436
events = capture_events()
3537

36-
client = InferenceClient()
38+
client = InferenceClient(model="https://")
39+
3740
if details_arg:
3841
post_mock = mock.Mock(
3942
return_value=b"""[{
@@ -92,7 +95,7 @@ def test_streaming_chat_completion(
9295
)
9396
events = capture_events()
9497

95-
client = InferenceClient()
98+
client = InferenceClient(model="https://")
9699

97100
post_mock = mock.Mock(
98101
return_value=[
@@ -141,7 +144,7 @@ def test_bad_chat_completion(sentry_init, capture_events):
141144
sentry_init(integrations=[HuggingfaceHubIntegration()], traces_sample_rate=1.0)
142145
events = capture_events()
143146

144-
client = InferenceClient()
147+
client = InferenceClient(model="https://")
145148
post_mock = mock.Mock(side_effect=OverloadedError("The server is overloaded"))
146149
mock_client_post(client, post_mock)
147150

@@ -159,7 +162,7 @@ def test_span_origin(sentry_init, capture_events):
159162
)
160163
events = capture_events()
161164

162-
client = InferenceClient()
165+
client = InferenceClient(model="https://")
163166
post_mock = mock.Mock(
164167
return_value=[
165168
b"""data:{

0 commit comments

Comments
 (0)