Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep ISH tests from failing CI if data unreachable #289

Merged
merged 4 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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