Skip to content

Commit 9b89d33

Browse files
authored
fix: don't skip tests marked as @skip_if_offline when running CIs (#244)
1 parent 296c4b3 commit 9b89d33

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/anemoi/utils/testing.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,16 @@ def _offline() -> bool:
246246
from urllib import request
247247
from urllib.error import URLError
248248

249+
# We consider ourselves online in CI environments, so that tests can run there
250+
# even if the website is not reachable. This ensure that we don't skip tests
251+
# unexpectedly in CI.
252+
253+
IN_CI = (os.environ.get("GITHUB_WORKFLOW") is not None) or (os.environ.get("IN_CI_HPC") is not None)
254+
if IN_CI:
255+
return False
256+
249257
try:
250-
request.urlopen("https://anemoi.ecmwf.int", timeout=1)
258+
request.urlopen("https://anemoi.ecmwf.int/status", timeout=10)
251259
return False
252260
except URLError:
253261
return True

0 commit comments

Comments
 (0)