|
16 | 16 |
|
17 | 17 | import pytest |
18 | 18 |
|
| 19 | +from isaaclab.physics import PhysicsCfg |
| 20 | + |
19 | 21 | import isaaclab_tasks # noqa: F401 |
| 22 | +from isaaclab_tasks.utils.hydra import collect_presets |
| 23 | +from isaaclab_tasks.utils.parse_cfg import load_cfg_from_registry |
20 | 24 |
|
21 | 25 | # Local imports should be imported last |
22 | 26 | from env_test_utils import _run_environments, setup_environment # isort: skip |
23 | 27 |
|
24 | 28 |
|
25 | | -@pytest.mark.parametrize("physics_preset_name", ["newton_mjwarp", "physx", "isaacsim_physx"]) |
| 29 | +_PHYSICS_PRESET_NAMES = ("newton_mjwarp", "physx", "isaacsim_physx") |
| 30 | + |
| 31 | + |
| 32 | +def _core_physics_params() -> list: |
| 33 | + """Return core task/backend pairs for explicitly supported physics presets.""" |
| 34 | + params = [] |
| 35 | + for task_param in setup_environment(multi_agent=False, tier="core"): |
| 36 | + task_name = getattr(task_param, "values", (task_param,))[0] |
| 37 | + marks = getattr(task_param, "marks", ()) |
| 38 | + env_cfg = load_cfg_from_registry(task_name, "env_cfg_entry_point") |
| 39 | + physics_preset_groups = collect_presets(env_cfg).values() |
| 40 | + for physics_preset_name in _PHYSICS_PRESET_NAMES: |
| 41 | + if any( |
| 42 | + physics_preset_name in preset_group and isinstance(preset_group[physics_preset_name], PhysicsCfg) |
| 43 | + for preset_group in physics_preset_groups |
| 44 | + ): |
| 45 | + params.append( |
| 46 | + pytest.param( |
| 47 | + task_name, |
| 48 | + physics_preset_name, |
| 49 | + id=f"{task_name}-{physics_preset_name}", |
| 50 | + marks=marks, |
| 51 | + ) |
| 52 | + ) |
| 53 | + return params |
| 54 | + |
| 55 | + |
| 56 | +@pytest.mark.parametrize("task_name, physics_preset_name", _core_physics_params()) |
26 | 57 | @pytest.mark.parametrize("num_envs, device", [(2, "cuda"), (1, "cuda")]) |
27 | | -@pytest.mark.parametrize( |
28 | | - "task_name", |
29 | | - setup_environment( |
30 | | - multi_agent=False, |
31 | | - tier="core", |
32 | | - ), |
33 | | -) |
34 | 58 | @pytest.mark.isaacsim_ci |
35 | 59 | def test_environments(task_name, physics_preset_name, num_envs, device): |
36 | 60 | # run environments without stage in memory |
|
0 commit comments