Repository: Project-MONAI/MONAI

Issue:
tests.test_warp HTTP Error 503
```
======================================================================
ERROR: test_grad (tests.test_warp.TestWarp)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\a\MONAI\MONAI\tests\test_warp.py", line 102, in setUp
    download_url_or_skip_test(
  File "D:\a\MONAI\MONAI\tests\utils.py", line 731, in download_url_or_skip_test
    download_url(*args, **kwargs)
  File "D:\a\MONAI\MONAI\monai\apps\utils.py", line 203, in download_url
    _download_with_progress(url, tmp_name, progress=progress)
  File "D:\a\MONAI\MONAI\monai\apps\utils.py", line 114, in _download_with_progress
    raise e
  File "D:\a\MONAI\MONAI\monai\apps\utils.py", line 111, in _download_with_progress
    urlretrieve(url, filepath)
  File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\urllib\request.py", line 247, in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
  File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\urllib\request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\urllib\request.py", line 531, in open
    response = meth(req, response)
  File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\urllib\request.py", line 640, in http_response
    response = self.parent.error(
  File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\urllib\request.py", line 563, in error
    result = self._call_chain(*args)
  File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\urllib\request.py", line 502, in _call_chain
    result = func(*args)
  File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\urllib\request.py", line 755, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\urllib\request.py", line 531, in open
    response = meth(req, response)
  File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\urllib\request.py", line 640, in http_response
    response = self.parent.error(
  File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\urllib\request.py", line 569, in error
    return self._call_chain(*args)
  File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\urllib\request.py", line 502, in _call_chain
    result = func(*args)
  File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\urllib\request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 503: Egress is over the account limit.

```
test_smartcachedataset thread hangs occasionally
**Describe the bug**
```
[2022-12-05T19:30:09.040Z] 
Loading dataset:   0%|          | 0/2 [00:00<?, ?it/s]
Loading dataset: 100%|██████████| 2/2 [00:00<00:00, 7577.79it/s]
[2022-12-05T19:30:09.040Z] .Finished test: test_datalist (tests.test_smartcachedataset.TestSmartCacheDataset) (0.00285s)
[2022-12-05T19:30:09.040Z] Starting test: test_set_data (tests.test_smartcachedataset.TestSmartCacheDataset)...
[2022-12-05T19:30:09.040Z] 
Loading dataset:   0%|          | 0/5 [00:00<?, ?it/s]
Loading dataset: 100%|██████████| 5/5 [00:00<00:00, 4430.91it/s]
[2022-12-05T21:52:01.667Z] Sending interrupt signal to process
[2022-12-05T21:52:01.669Z] Killing processes
[2022-12-05T21:52:02.262Z] kill finished with exit code 0
[2022-12-05T21:52:02.264Z] Sending interrupt signal to process
[2022-12-05T21:52:02.264Z] Killing processes
[2022-12-05T21:52:02.596Z] kill finished with exit code 2
[2022-12-05T21:52:02.824Z] Terminated
[2022-12-05T21:52:02.827Z] script returned exit code 143
```


Discussion:

874ab2a7aef375626e019989938aff3069b04450

Resolving patch:
diff --git a/monai/handlers/checkpoint_saver.py b/monai/handlers/checkpoint_saver.py
--- a/monai/handlers/checkpoint_saver.py
+++ b/monai/handlers/checkpoint_saver.py
@@ -18,7 +18,6 @@
 
 Events, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Events")
 
-
 if TYPE_CHECKING:
     from ignite.engine import Engine
     from ignite.handlers import Checkpoint, DiskSaver


Test patch:
diff --git a/tests/test_convert_data_type.py b/tests/test_convert_data_type.py
--- a/tests/test_convert_data_type.py
+++ b/tests/test_convert_data_type.py
@@ -56,7 +56,6 @@
                 )
             )
 
-
 UNSUPPORTED_TYPES = {np.dtype("uint16"): torch.int32, np.dtype("uint32"): torch.int64, np.dtype("uint64"): torch.int64}
 
 
diff --git a/tests/test_hovernet_nuclear_type_post_processingd.py b/tests/test_hovernet_nuclear_type_post_processingd.py
--- a/tests/test_hovernet_nuclear_type_post_processingd.py
+++ b/tests/test_hovernet_nuclear_type_post_processingd.py
@@ -30,10 +30,8 @@
 image = (x - 10) ** 2 + (y - 10) ** 2 <= 5**2
 image = image[None, ...].astype("uint8")
 
-
 TEST_CASE_1 = [{}, [{"1": [10, 10]}, np.zeros_like(image), np.zeros_like(image)]]
 
-
 TEST_CASE = []
 for p in TEST_NDARRAYS:
     TEST_CASE.append([p, image] + TEST_CASE_1)
diff --git a/tests/test_safe_dtype_range.py b/tests/test_safe_dtype_range.py
--- a/tests/test_safe_dtype_range.py
+++ b/tests/test_safe_dtype_range.py
@@ -29,7 +29,7 @@
         TESTS.append((in_type(np.array(256)), in_type(np.array(255)), np.uint8))  # type: ignore
         TESTS.append((in_type(np.array(-12)), in_type(np.array(0)), np.uint8))  # type: ignore
 for in_type in TEST_NDARRAYS_ALL:
-    TESTS.append((in_type(np.array([[256, 255], [-12, 0]])), in_type(np.array([[255, 255], [0, 0]])), np.uint8))  # type: ignore
+    TESTS.append((in_type(np.array([[256, 255], [-12, 0]])), in_type(np.array([[255, 255], [0, 0]])), np.uint8))
 
 TESTS_LIST: List[Tuple] = []
 for in_type in TEST_NDARRAYS_ALL + (int, float):
diff --git a/tests/test_smartcachedataset.py b/tests/test_smartcachedataset.py
--- a/tests/test_smartcachedataset.py
+++ b/tests/test_smartcachedataset.py
@@ -140,6 +140,7 @@ def test_shuffle(self):
 
         dataset.shutdown()
 
+    @unittest.skip("https://github.com/Project-MONAI/MONAI/issues/5660 blocks the ci")
     def test_set_data(self):
         data_list1 = list(range(10))
 
diff --git a/tests/utils.py b/tests/utils.py
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -129,7 +129,7 @@ def skip_if_downloading_fails():
     except ssl.SSLError as ssl_e:
         if "decryption failed" in str(ssl_e):
             raise unittest.SkipTest(f"SSL error while downloading: {ssl_e}") from ssl_e
-    except RuntimeError as rt_e:
+    except (RuntimeError, OSError) as rt_e:
         if "unexpected EOF" in str(rt_e):
             raise unittest.SkipTest(f"error while downloading: {rt_e}") from rt_e  # incomplete download
         if "network issue" in str(rt_e):