Skip to content

Commit

Permalink
Merge pull request #289 from zmoon/skip-ish
Browse files Browse the repository at this point in the history
Keep ISH tests from failing CI if data unreachable
  • Loading branch information
zmoon authored Oct 7, 2024
2 parents f18f3ab + 00a93a4 commit 61a618c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
python -c "import monet; print('monet.__version__', getattr(monet, '__version__', '?'))"
- name: pytest
run: python -m pytest -v melodies_monet
run: python -m pytest -v -rsx melodies_monet

- name: Run docs/examples notebooks as scripts
run: |
Expand Down
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@
"https://www2.cisl.ucar.edu/resources/conda-environments",
# Sphinx 4.5 linkcheck having problem:
"https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account",
# NCEI sites having problems
"https://www.ncdc.noaa.gov/crn/",
]
user_agent = "Mozilla/5.0 (X11; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0"

Expand Down
18 changes: 18 additions & 0 deletions melodies_monet/tests/test_get_data_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,26 @@
import subprocess

import numpy as np
import pytest
import requests
import xarray as xr

from melodies_monet.tutorial import fetch_example

try:
requests.head("https://www1.ncdc.noaa.gov/pub/data/noaa/")
except Exception:
ish_reachable = False
else:
ish_reachable = True

try:
requests.head("https://www1.ncdc.noaa.gov/pub/data/noaa/isd-lite/")
except Exception:
ish_lite_reachable = False
else:
ish_lite_reachable = True

ds0_aeronet = xr.open_dataset(fetch_example("aeronet:2019-09"))
ds0_airnow = xr.open_dataset(fetch_example("airnow:2019-09"))

Expand Down Expand Up @@ -84,6 +100,7 @@ def test_get_airnow_comp(tmp_path):
assert (np.abs(ds[vn] - ds0[vn]).to_series().dropna() < 3e-7).all()


@pytest.mark.xfail(not ish_lite_reachable, reason="data not reachable")
def test_get_ish_lite_box(tmp_path):
fn = "x.nc"
cmd = [
Expand All @@ -100,6 +117,7 @@ def test_get_ish_lite_box(tmp_path):
assert np.unique(ds.state) == ["CO"]


@pytest.mark.xfail(not ish_reachable, reason="data not reachable")
def test_get_ish_box(tmp_path):
fn = "x.nc"
cmd = [
Expand Down

0 comments on commit 61a618c

Please sign in to comment.