forked from isaac-sim/IsaacLab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_backend_utils.py
More file actions
34 lines (23 loc) · 1.56 KB
/
Copy pathtest_backend_utils.py
File metadata and controls
34 lines (23 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md).
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
"""Tests for backend module resolution."""
from isaaclab.sim.simulation_context import SimulationContext
from isaaclab.utils.backend_utils import FactoryBase
def test_get_module_name_routes_ovphysx_to_isaaclab_ov(monkeypatch):
"""OVPhysX backend modules resolve from the consolidated package."""
monkeypatch.setattr(FactoryBase, "_module_subpath", "assets.articulation", raising=False)
assert FactoryBase._get_package_name("ovphysx") == "isaaclab_ov"
assert FactoryBase._get_module_name("ovphysx") == "isaaclab_ov.assets.articulation"
def test_get_module_name_preserves_other_backend_conventions(monkeypatch):
"""Other backend modules continue to use their backend-named packages."""
monkeypatch.setattr(FactoryBase, "_module_subpath", "assets.articulation", raising=False)
assert FactoryBase._get_package_name("physx") == "isaaclab_physx"
assert FactoryBase._get_package_name("newton") == "isaaclab_newton"
assert FactoryBase._get_module_name("physx") == "isaaclab_physx.assets.articulation"
assert FactoryBase._get_module_name("newton") == "isaaclab_newton.assets.articulation"
def test_factory_backend_falls_back_to_newton_without_simulation_context(monkeypatch):
"""Backend resolution uses Newton before a simulation context exists."""
monkeypatch.setattr(SimulationContext, "_instance", None)
assert FactoryBase._get_backend() == "newton"