From e0668664791ec6ecaab94a190af153c144ac465a Mon Sep 17 00:00:00 2001 From: stancld Date: Tue, 12 Jul 2022 21:15:06 +0200 Subject: [PATCH 1/3] Bugfix: Update message regarding connection issues to the HF hub --- tests/unittests/text/helpers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unittests/text/helpers.py b/tests/unittests/text/helpers.py index 72b3ff56302..3d3e63b7d80 100644 --- a/tests/unittests/text/helpers.py +++ b/tests/unittests/text/helpers.py @@ -440,7 +440,7 @@ 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"] def test_decorator(function: Callable, *args: Any, **kwargs: Any) -> Optional[Callable]: @wraps(function) @@ -448,7 +448,7 @@ 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): + if all(msg_start not in str(ex) for msg_start in _error_msg_starts): raise ex pytest.skip(reason) From 2d555ba16f0947cc9819ffc4b5a5cab34d84bb1c Mon Sep 17 00:00:00 2001 From: stancld Date: Tue, 12 Jul 2022 21:38:16 +0200 Subject: [PATCH 2/3] bugfix: Catch both OSError and ValueError --- tests/unittests/text/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unittests/text/helpers.py b/tests/unittests/text/helpers.py index 3d3e63b7d80..22cad69f379 100644 --- a/tests/unittests/text/helpers.py +++ b/tests/unittests/text/helpers.py @@ -447,7 +447,7 @@ def test_decorator(function: Callable, *args: Any, **kwargs: Any) -> Optional[Ca def run_test(*args: Any, **kwargs: Any) -> Optional[Any]: try: return function(*args, **kwargs) - except OSError as 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) From 8396b1b2488ce0208c14868fc2b9a77846e88add Mon Sep 17 00:00:00 2001 From: stancld Date: Tue, 12 Jul 2022 22:10:22 +0200 Subject: [PATCH 3/3] bugfix: Catch - Can't load ... - error message --- tests/unittests/text/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unittests/text/helpers.py b/tests/unittests/text/helpers.py index 22cad69f379..ad4d091d48c 100644 --- a/tests/unittests/text/helpers.py +++ b/tests/unittests/text/helpers.py @@ -440,7 +440,7 @@ 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_starts = ["We couldn't connect to", "Connection error"] + _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)