Skip to content

Commit

Permalink
Merge pull request #2527 from pytroll/ci-unstable-deps-new-url
Browse files Browse the repository at this point in the history
  • Loading branch information
djhoese authored Jul 7, 2023
2 parents 17006a8 + f8f6dd6 commit 8490966
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
14 changes: 10 additions & 4 deletions satpy/tests/reader_tests/gms/test_gms5_vissr_l1b.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
10 changes: 8 additions & 2 deletions satpy/tests/reader_tests/gms/test_gms5_vissr_navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 21 additions & 0 deletions satpy/tests/reader_tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"""Utilities for reader tests."""

import inspect
import os


def default_attr_processor(root, attr):
Expand Down Expand Up @@ -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")

0 comments on commit 8490966

Please sign in to comment.