diff --git a/tests/helper_functions.py b/tests/helper_functions.py index 7b579e4fd..4e82bbe1a 100644 --- a/tests/helper_functions.py +++ b/tests/helper_functions.py @@ -3,6 +3,13 @@ import requests +class HTTPError(Exception): + def __init__(self, status_code, message): + self.status_code = status_code + self.message = message + super().__init__(f"HTTPError {status_code}: {message}") + + def download_test_data(nexus_url, filename): local_directory = "./tests/data" @@ -15,7 +22,8 @@ def download_test_data(nexus_url, filename): if not os.path.exists(local_file_path): session = requests.Session() response = session.get(nexus_url) - # response.raise_for_status() + if response.status_code != 200: + raise HTTPError(response.status_code, "Failed to download data.") # Save the downloaded data to the local file with open(local_file_path, "wb") as f: f.write(response.content)