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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow read timeout error in preparation tests #1615

Merged
merged 2 commits into from
Feb 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 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 @@ -76,7 +76,18 @@ def test_preparations(self):
)
continue
self.assertTrue(False)
raise
raise e
except Exception as e:
current_exception = e
import requests
while current_exception:
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:
raise e

logger.info(f"Testing preparation file: {file} passed")
self.assertTrue(True)

Expand Down