Skip to content

Commit 5f00712

Browse files
Jammy2211claude
authored andcommitted
test: skip jax-backed tests when jax is absent (Python matrix)
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 <noreply@anthropic.com>
1 parent 4477fd5 commit 5f00712

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

test_autoarray/inversion/pixelization/interpolator/test_knn_barycentric.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1+
import importlib.util
2+
13
import numpy as np
24
import pytest
35

46
from autoarray.inversion.mesh.interpolator.knn import (
57
barycentric_weights_from_3_nearest,
68
)
79

10+
# The kNN weight computation is jax-backed; these tests need jax installed to
11+
# run (it ships via the `[optional]` extras). The NumPy-only Python-version
12+
# matrix has no jax, so skip there rather than fail.
13+
requires_jax = pytest.mark.skipif(
14+
importlib.util.find_spec("jax") is None,
15+
reason="requires jax (installed via the [optional] extras; absent on the NumPy-only matrix env)",
16+
)
17+
818

919
def test__weights__interior_query_matches_delaunay_exactly():
1020
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():
129139
assert mesh.split_neighbor_division == 2
130140

131141

142+
@requires_jax
132143
def test__interpolator__numpy_path_returns_writable_mappings_and_weights():
133144
"""
134145
Regression guard: on the numpy path, `mappings` and `weights` must be

0 commit comments

Comments
 (0)