From af8b3273233110c4a486a4397b2d32ba5bad5da0 Mon Sep 17 00:00:00 2001 From: Daniel Stancl <46073029+stancld@users.noreply.github.com> Date: Tue, 12 Jul 2022 23:00:49 +0200 Subject: [PATCH] Bugfix: Update message regarding connection issues to the HF hub (#1141) (cherry picked from commit 6621c0f61e6a6fbd8cac821fd66df21d8cc4615a) --- tests/text/helpers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/text/helpers.py b/tests/text/helpers.py index 9a3cbed282f..9268190f42d 100644 --- a/tests/text/helpers.py +++ b/tests/text/helpers.py @@ -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)