Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Update message regarding connection issues to the HF hub #1141

Merged
merged 3 commits into from Jul 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions tests/unittests/text/helpers.py
Expand Up @@ -440,15 +440,15 @@ def skip_on_connection_issues(reason: str = "Unable to load checkpoints from Hug

The tests run normally if no connection issue arises, and they're marked as skipped otherwise.
"""
_error_msg_start = "We couldn't connect to"
_error_msg_starts = ["We couldn't connect to", "Connection error", "Can't load"]

def test_decorator(function: Callable, *args: Any, **kwargs: Any) -> Optional[Callable]:
@wraps(function)
def run_test(*args: Any, **kwargs: Any) -> Optional[Any]:
try:
return function(*args, **kwargs)
except OSError as ex:
if _error_msg_start not in str(ex):
except (OSError, ValueError) as ex:
if all(msg_start not in str(ex) for msg_start in _error_msg_starts):
raise ex
pytest.skip(reason)

Expand Down