Skip to content

Commit 99a2a53

Browse files
committed
make tests smoother
1 parent 4112c55 commit 99a2a53

File tree

1 file changed

+9
-1
lines changed
  • bioimageio/spec/_internal

1 file changed

+9
-1
lines changed

bioimageio/spec/_internal/url.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ def _validate_url(url: Union[str, pydantic.HttpUrl]) -> pydantic.HttpUrl:
1717
return _validate_url_impl(url, request_mode="head")
1818

1919

20+
_KNOWN_VALID_URLS = ("https://zenodo.org/records/3446812/files/unet2d_weights.torch",)
21+
"""known valid urls to bypass validation for to avoid sporadic 503 errors in tests etc."""
22+
23+
2024
def _validate_url_impl(
2125
url: Union[str, pydantic.HttpUrl],
2226
request_mode: Literal["head", "get_stream", "get"],
@@ -30,7 +34,11 @@ def _validate_url_impl(
3034

3135
val_url = url
3236

33-
if url.startswith("http://example.com") or url.startswith("https://example.com"):
37+
if (
38+
url.startswith("http://example.com")
39+
or url.startswith("https://example.com")
40+
or url in _KNOWN_VALID_URLS
41+
):
3442
return pydantic.HttpUrl(url)
3543

3644
if url.startswith("https://colab.research.google.com/github/"):

0 commit comments

Comments
 (0)