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)