diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8f6816285c..faa0aea2cc 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -90,7 +90,7 @@ jobs: # may break the conda-forge libraries trying to use newer glibc versions run: | python -m pip install \ - --index-url https://pypi.anaconda.org/scipy-wheels-nightly/simple/ \ + --index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple/ \ --trusted-host pypi.anaconda.org \ --no-deps --pre --upgrade \ matplotlib \ diff --git a/satpy/tests/reader_tests/gms/test_gms5_vissr_l1b.py b/satpy/tests/reader_tests/gms/test_gms5_vissr_l1b.py index 31482f1e10..f4908c0a2b 100644 --- a/satpy/tests/reader_tests/gms/test_gms5_vissr_l1b.py +++ b/satpy/tests/reader_tests/gms/test_gms5_vissr_l1b.py @@ -9,14 +9,20 @@ import xarray as xr from pyresample.geometry import AreaDefinition -import satpy.readers.gms.gms5_vissr_format as fmt -import satpy.readers.gms.gms5_vissr_l1b as vissr -import satpy.readers.gms.gms5_vissr_navigation as nav import satpy.tests.reader_tests.gms.test_gms5_vissr_data as real_world from satpy.readers import FSFile -from satpy.tests.reader_tests.utils import get_jit_methods +from satpy.tests.reader_tests.utils import get_jit_methods, skip_numba_unstable_if_missing from satpy.tests.utils import make_dataid +try: + import satpy.readers.gms.gms5_vissr_format as fmt + import satpy.readers.gms.gms5_vissr_l1b as vissr + import satpy.readers.gms.gms5_vissr_navigation as nav +except ImportError as err: + if skip_numba_unstable_if_missing(): + pytest.skip(f"Numba is not compatible with unstable NumPy: {err!s}", allow_module_level=True) + raise + @pytest.fixture(params=[False, True], autouse=True) def disable_jit(request, monkeypatch): diff --git a/satpy/tests/reader_tests/gms/test_gms5_vissr_navigation.py b/satpy/tests/reader_tests/gms/test_gms5_vissr_navigation.py index 47c5fd044c..144139a07a 100644 --- a/satpy/tests/reader_tests/gms/test_gms5_vissr_navigation.py +++ b/satpy/tests/reader_tests/gms/test_gms5_vissr_navigation.py @@ -3,8 +3,14 @@ import numpy as np import pytest -import satpy.readers.gms.gms5_vissr_navigation as nav -from satpy.tests.reader_tests.utils import get_jit_methods +from satpy.tests.reader_tests.utils import get_jit_methods, skip_numba_unstable_if_missing + +try: + import satpy.readers.gms.gms5_vissr_navigation as nav +except ImportError as err: + if skip_numba_unstable_if_missing(): + pytest.skip(f"Numba is not compatible with unstable NumPy: {err!s}", allow_module_level=True) + raise # Navigation references computed with JMA's Msial library (files # VISSR_19960217_2331_IR1.A.IMG and VISSR_19960217_2331_VIS.A.IMG). The VIS diff --git a/satpy/tests/reader_tests/utils.py b/satpy/tests/reader_tests/utils.py index 9415ac56ec..05e6d9cb18 100644 --- a/satpy/tests/reader_tests/utils.py +++ b/satpy/tests/reader_tests/utils.py @@ -18,6 +18,7 @@ """Utilities for reader tests.""" import inspect +import os def default_attr_processor(root, attr): @@ -61,3 +62,23 @@ def get_jit_methods(module): def _is_jit_method(obj): return hasattr(obj, "py_func") + + +def skip_numba_unstable_if_missing(): + """Determine if numba-based tests should be skipped during unstable CI tests. + + If numba fails to import it could be because numba is not compatible with + a newer version of numpy. This is very likely to happen in the + unstable/experimental CI environment. This function returns ``True`` if + numba-based tests should be skipped if ``numba`` could not + be imported *and* we're in the unstable environment. We determine if we're + in this CI environment by looking for the ``UNSTABLE="1"`` + environment variable. + + """ + try: + import numba + except ImportError: + numba = None + + return numba is None and os.environ.get("UNSTABLE", "0") in ("1", "true")