Unverified Commit 5b954cc9 authored by jsmith-bdai's avatar jsmith-bdai Committed by GitHub

Fixes warp library access in unit tests (#378)

# Description

Recently, tests were discovered that import from `utils`: `from
omni.isaac.orbit.utils` cause a `ModuleNotFoundError` for `warp` within
a container workflow fail as they weren't starting up the simulation
app.

This PR fixes this issue by setting up simulation app in any tests that
need it.

Fixes #372

## Type of change

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

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./orbit.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] I have run all the tests with `./orbit.sh --test` and they pass
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
parent 477cd6b3
......@@ -5,14 +5,29 @@
from __future__ import annotations
# NOTE: While we don't actually use the simulation app in this test, we still need to launch it
# because warp is only available in the context of a running simulation
"""Launch Isaac Sim Simulator first."""
from omni.isaac.orbit.app import AppLauncher
# launch omniverse app
app_launcher = AppLauncher(headless=True)
simulation_app = app_launcher.app
"""Rest everything follows."""
import copy
import os
import sys
import traceback
import unittest
from dataclasses import MISSING, asdict, field
from functools import wraps
from typing import Callable, ClassVar
import carb
from omni.isaac.orbit.utils.configclass import configclass
from omni.isaac.orbit.utils.dict import class_to_dict, update_class_from_dict
from omni.isaac.orbit.utils.io import dump_yaml, load_yaml
......@@ -696,4 +711,12 @@ class TestConfigClass(unittest.TestCase):
if __name__ == "__main__":
unittest.main()
try:
unittest.main()
except Exception as err:
carb.log_error(err)
carb.log_error(traceback.format_exc())
raise
finally:
# close sim app
simulation_app.close()
......@@ -5,8 +5,23 @@
from __future__ import annotations
# NOTE: While we don't actually use the simulation app in this test, we still need to launch it
# because warp is only available in the context of a running simulation
"""Launch Isaac Sim Simulator first."""
from omni.isaac.orbit.app import AppLauncher
# launch omniverse app
app_launcher = AppLauncher(headless=True)
simulation_app = app_launcher.app
"""Rest everything follows."""
import traceback
import unittest
import carb
import omni.isaac.orbit.utils.dict as dict_utils
......@@ -71,4 +86,12 @@ class TestDictUtilities(unittest.TestCase):
if __name__ == "__main__":
unittest.main()
try:
unittest.main()
except Exception as err:
carb.log_error(err)
carb.log_error(traceback.format_exc())
raise
finally:
# close sim app
simulation_app.close()
......@@ -5,9 +5,24 @@
from __future__ import annotations
# NOTE: While we don't actually use the simulation app in this test, we still need to launch it
# because warp is only available in the context of a running simulation
"""Launch Isaac Sim Simulator first."""
from omni.isaac.orbit.app import AppLauncher
# launch omniverse app
app_launcher = AppLauncher(headless=True)
simulation_app = app_launcher.app
"""Rest everything follows."""
import random
import traceback
import unittest
import carb
import omni.isaac.orbit.utils.string as string_utils
......@@ -118,4 +133,12 @@ class TestStringUtilities(unittest.TestCase):
if __name__ == "__main__":
unittest.main()
try:
unittest.main()
except Exception as err:
carb.log_error(err)
carb.log_error(traceback.format_exc())
raise
finally:
# close sim app
simulation_app.close()
......@@ -5,9 +5,24 @@
from __future__ import annotations
# NOTE: While we don't actually use the simulation app in this test, we still need to launch it
# because warp is only available in the context of a running simulation
"""Launch Isaac Sim Simulator first."""
from omni.isaac.orbit.app import AppLauncher
# launch omniverse app
app_launcher = AppLauncher(headless=True)
simulation_app = app_launcher.app
"""Rest everything follows."""
import time
import traceback
import unittest
import carb
from omni.isaac.orbit.utils.timer import Timer
......@@ -37,4 +52,12 @@ class TestTimer(unittest.TestCase):
if __name__ == "__main__":
unittest.main()
try:
unittest.main()
except Exception as err:
carb.log_error(err)
carb.log_error(traceback.format_exc())
raise
finally:
# close sim app
simulation_app.close()
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