Skip to content

Commit 07fcc0e

Browse files
Jammy2211claude
authored andcommitted
test(conftest): make jax import lazy so tests collect without JAX
JAX is now an optional dep gated on python_version >= '3.11'. The eager `import jax` at the top of test_autoarray/conftest.py was breaking pytest collection on 3.9 and 3.10 (no JAX installed). Wrap in try/except, gate jnp warmup on _JAX_AVAILABLE. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent baa52dd commit 07fcc0e

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

test_autoarray/conftest.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
import jax
2-
import jax.numpy as jnp
1+
try:
2+
import jax
3+
import jax.numpy as jnp
34

4-
jax.config.update("jax_enable_x64", True)
5+
jax.config.update("jax_enable_x64", True)
6+
_JAX_AVAILABLE = True
7+
except ImportError:
8+
_JAX_AVAILABLE = False
59

610

711
def pytest_configure():
8-
_ = jnp.sum(jnp.array([0.0])) # Force backend init
12+
if _JAX_AVAILABLE:
13+
_ = jnp.sum(jnp.array([0.0])) # Force backend init
914

1015

1116
import os

0 commit comments

Comments
 (0)