Skip to content

Commit

Permalink
Handle additional connection errors in preparation tests
Browse files Browse the repository at this point in the history
Signed-off-by: elronbandel <[email protected]>
  • Loading branch information
elronbandel committed Feb 18, 2025
1 parent 05647c5 commit ab96ee2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/catalog/test_preparation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import tracemalloc

import psutil
from huggingface_hub.utils import GatedRepoError
from huggingface_hub.errors import GatedRepoError, HfHubHTTPError
from unitxt.loaders import MissingKaggleCredentialsError
from unitxt.logging_utils import get_logger
from unitxt.settings_utils import get_constants, get_settings
Expand Down Expand Up @@ -81,8 +81,8 @@ def test_preparations(self):
current_exception = e
import requests
while current_exception:
if isinstance(current_exception, requests.exceptions.ReadTimeout):
logger.error(f"ReadTimeout occurred in {file}")
if isinstance(current_exception, (requests.exceptions.ReadTimeout, HfHubHTTPError)):
logger.error(f"Connection error occurred in {file}. Error: {e}.")
break
current_exception = current_exception.__cause__ or current_exception.__context__
else:
Expand Down

0 comments on commit ab96ee2

Please sign in to comment.