From 5f0071294f144237bbfff7907dfcb983199de121 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Sat, 11 Jul 2026 11:45:20 +0100 Subject: [PATCH] test: skip jax-backed tests when jax is absent (Python matrix) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These tests exercise jax-only code paths (vmapped profiles / blackjax NUTS / nufft sparse operator / use_jax=True), so they need jax installed to run — it ships via the [optional] extras and is present in the per-repo CI (3.12/3.13). The PyAutoBuild Python Version Matrix installs the NumPy-only stack (and jax can't install on 3.9 anyway), so guard the 1 affected test(s) with a skipif on jax availability rather than letting them ModuleNotFoundError. Numpy-only tests in the same files are unaffected. Co-Authored-By: Claude Opus 4.8 --- .../pixelization/interpolator/test_knn_barycentric.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test_autoarray/inversion/pixelization/interpolator/test_knn_barycentric.py b/test_autoarray/inversion/pixelization/interpolator/test_knn_barycentric.py index 39c9632f..74829650 100644 --- a/test_autoarray/inversion/pixelization/interpolator/test_knn_barycentric.py +++ b/test_autoarray/inversion/pixelization/interpolator/test_knn_barycentric.py @@ -1,3 +1,5 @@ +import importlib.util + import numpy as np import pytest @@ -5,6 +7,14 @@ barycentric_weights_from_3_nearest, ) +# The kNN weight computation is jax-backed; these tests need jax installed to +# run (it ships via the `[optional]` extras). The NumPy-only Python-version +# matrix has no jax, so skip there rather than fail. +requires_jax = pytest.mark.skipif( + importlib.util.find_spec("jax") is None, + reason="requires jax (installed via the [optional] extras; absent on the NumPy-only matrix env)", +) + def test__weights__interior_query_matches_delaunay_exactly(): mesh = np.array([[0.0, 0.0], [1.0, 0.0], [0.0, 1.0]]) @@ -129,6 +139,7 @@ def test__mesh_class__inherits_knn_knobs(): assert mesh.split_neighbor_division == 2 +@requires_jax def test__interpolator__numpy_path_returns_writable_mappings_and_weights(): """ Regression guard: on the numpy path, `mappings` and `weights` must be