Skip to content

Commit e7ca43b

Browse files
committed
Fix render tests
1 parent 213c277 commit e7ca43b

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

tests/unit/test_sim.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
import jax
24
import jax.numpy as jnp
35
import numpy as np
@@ -28,6 +30,11 @@ def skip_unavailable_device(device: str):
2830
pytest.skip(f"{device} device not available")
2931

3032

33+
def skip_headless():
34+
if os.environ.get("DISPLAY") is None:
35+
pytest.skip("DISPLAY is not set, skipping test in headless environment")
36+
37+
3138
def array_meta_assert(
3239
x: Array,
3340
shape: tuple[int, ...] | None = None,
@@ -270,6 +277,7 @@ def test_render_human(device: str):
270277
@pytest.mark.parametrize("device", ["gpu", "cpu"])
271278
def test_render_rgb_array(device: str):
272279
skip_unavailable_device(device)
280+
skip_headless()
273281
sim = Sim(n_worlds=2, device=device)
274282
img = sim.render(mode="rgb_array", width=1024, height=1024)
275283
assert isinstance(img, np.ndarray), "Image must be a numpy array"

0 commit comments

Comments
 (0)