Unverified Commit 6184b562 authored by James Tigue's avatar James Tigue Committed by GitHub

Fixes articulation and render_cfg tests to be proper pytests (#2851)

# Description

Fixes some pytest migration errors for test_articulation and
test_render_cfg

Fixes # (issue)

## Type of change

<!-- As you go through the list, delete the ones that are not
applicable. -->

- Bug fix (non-breaking change which fixes an issue)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [ ] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

<!--
As you go through the checklist above, you can mark something as done by
putting an x character in it

For example,
- [x] I have done this task
- [ ] I have not done this task
-->

---------
Signed-off-by: 's avatarKelly Guo <kellyg@nvidia.com>
Signed-off-by: 's avatarKelly Guo <kellyguo123@hotmail.com>
Co-authored-by: 's avatarKelly Guo <kellyg@nvidia.com>
Co-authored-by: 's avatarKelly Guo <kellyguo123@hotmail.com>
parent 043f045c
[package] [package]
# Note: Semantic Versioning is used: https://semver.org/ # Note: Semantic Versioning is used: https://semver.org/
version = "0.40.12" version = "0.40.13"
# Description # Description
title = "Isaac Lab framework for Robot Learning" title = "Isaac Lab framework for Robot Learning"
......
Changelog Changelog
--------- ---------
0.40.13 (2025-07-03)
~~~~~~~~~~~~~~~~~~~~
Fixed
^^^^^
* Fixed unittest tests that are floating inside pytests for articulation and rendering
0.40.12 (2025-07-03) 0.40.12 (2025-07-03)
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
......
...@@ -1572,36 +1572,38 @@ def test_body_incoming_joint_wrench_b_single_joint(sim, num_articulations, devic ...@@ -1572,36 +1572,38 @@ def test_body_incoming_joint_wrench_b_single_joint(sim, num_articulations, devic
rtol=1e-3, rtol=1e-3,
) )
def test_setting_articulation_root_prim_path(self):
@pytest.mark.parametrize("device", ["cuda:0", "cpu"])
def test_setting_articulation_root_prim_path(sim, device):
"""Test that the articulation root prim path can be set explicitly.""" """Test that the articulation root prim path can be set explicitly."""
with build_simulation_context(device="cuda:0", add_ground_plane=False, auto_add_lighting=True) as sim:
sim._app_control_on_stop_handle = None sim._app_control_on_stop_handle = None
# Create articulation # Create articulation
articulation_cfg = generate_articulation_cfg(articulation_type="humanoid") articulation_cfg = generate_articulation_cfg(articulation_type="humanoid")
print(articulation_cfg.spawn.usd_path) print(articulation_cfg.spawn.usd_path)
articulation_cfg.articulation_root_prim_path = "/torso" articulation_cfg.articulation_root_prim_path = "/torso"
articulation, _ = generate_articulation(articulation_cfg, 1, "cuda:0") articulation, _ = generate_articulation(articulation_cfg, 1, device)
# Check that boundedness of articulation is correct # Check that boundedness of articulation is correct
self.assertEqual(ctypes.c_long.from_address(id(articulation)).value, 1) assert ctypes.c_long.from_address(id(articulation)).value == 1
# Play sim # Play sim
sim.reset() sim.reset()
# Check if articulation is initialized # Check if articulation is initialized
self.assertTrue(articulation._is_initialized) assert articulation._is_initialized
def test_setting_invalid_articulation_root_prim_path(self):
@pytest.mark.parametrize("device", ["cuda:0", "cpu"])
def test_setting_invalid_articulation_root_prim_path(sim, device):
"""Test that the articulation root prim path can be set explicitly.""" """Test that the articulation root prim path can be set explicitly."""
with build_simulation_context(device="cuda:0", add_ground_plane=False, auto_add_lighting=True) as sim:
sim._app_control_on_stop_handle = None sim._app_control_on_stop_handle = None
# Create articulation # Create articulation
articulation_cfg = generate_articulation_cfg(articulation_type="humanoid") articulation_cfg = generate_articulation_cfg(articulation_type="humanoid")
print(articulation_cfg.spawn.usd_path) print(articulation_cfg.spawn.usd_path)
articulation_cfg.articulation_root_prim_path = "/non_existing_prim_path" articulation_cfg.articulation_root_prim_path = "/non_existing_prim_path"
articulation, _ = generate_articulation(articulation_cfg, 1, "cuda:0") articulation, _ = generate_articulation(articulation_cfg, 1, device=device)
# Check that boundedness of articulation is correct # Check that boundedness of articulation is correct
self.assertEqual(ctypes.c_long.from_address(id(articulation)).value, 1) assert ctypes.c_long.from_address(id(articulation)).value == 1
# Play sim # Play sim
with pytest.raises(RuntimeError): with pytest.raises(RuntimeError):
......
...@@ -89,7 +89,8 @@ def test_render_cfg(): ...@@ -89,7 +89,8 @@ def test_render_cfg():
assert carb_settings_iface.get("/rtx/ambientOcclusion/enabled") == sim.cfg.render.enable_ambient_occlusion assert carb_settings_iface.get("/rtx/ambientOcclusion/enabled") == sim.cfg.render.enable_ambient_occlusion
assert carb_settings_iface.get("/rtx/post/aa/op") == 4 # dlss = 3, dlaa=4 assert carb_settings_iface.get("/rtx/post/aa/op") == 4 # dlss = 3, dlaa=4
def test_render_cfg_presets(self):
def test_render_cfg_presets():
"""Test that the simulation context is created with the correct render cfg preset with overrides.""" """Test that the simulation context is created with the correct render cfg preset with overrides."""
# carb setting dictionary overrides # carb setting dictionary overrides
...@@ -132,7 +133,7 @@ def test_render_cfg(): ...@@ -132,7 +133,7 @@ def test_render_cfg():
setting_val = get_carb_setting(carb_settings_iface, setting_name) setting_val = get_carb_setting(carb_settings_iface, setting_name)
self.assertEqual(setting_gt, setting_val) assert setting_gt == setting_val
@pytest.mark.skip(reason="Timeline not stopped") @pytest.mark.skip(reason="Timeline not stopped")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment