File tree Expand file tree Collapse file tree
upath/tests/implementations Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818)
1919
2020
21- def has_internet_connection ():
22- import requests
23-
24- try :
25- requests .get ("http://example.com" )
26- except requests .exceptions .ConnectionError :
27- return False
28- else :
29- return True
30-
31-
3221def xfail_on_github_rate_limit (func ):
3322 """
3423 Method decorator to mark test as xfail when GitHub rate limit is exceeded.
Original file line number Diff line number Diff line change 1- import functools
2-
31import pytest
42from fsspec import get_filesystem_class
53
1412 pytestmark = pytest .mark .skip
1513
1614
17- def xfail_on_hf_service_unavailable (func ):
18- """
19- Method decorator to mark test as xfail when HuggingFace service is unavailable.
20- """
21- from httpx import HTTPStatusError
22-
23- @functools .wraps (func )
24- def wrapped_method (self , * args , ** kwargs ):
25- try :
26- return func (self , * args , ** kwargs )
27- except HTTPStatusError as err :
28- if err .response .status_code == 503 :
29- pytest .xfail ("HuggingFace API not reachable" )
30- raise
31-
32- return wrapped_method
33-
34-
3515def test_hfpath ():
3616 path = UPath ("hf://HuggingFaceTB/SmolLM2-135M" )
3717 assert isinstance (path , HfPath )
You can’t perform that action at this time.
0 commit comments