Some checks failed
nightly / Test against latest dependencies (py3.10) (push) Has been cancelled
nightly / Test against latest dependencies (py3.13) (push) Has been cancelled
tests / tests (3.13, locked) (push) Has been cancelled
tests / tests (3.13, unlocked) (push) Has been cancelled
tests / pyright (3.10) (push) Has been cancelled
tests / lint-format (push) Has been cancelled
tests / tests (3.10, locked) (push) Has been cancelled
tests / tests (3.11, locked) (push) Has been cancelled
tests / tests (3.12, locked) (push) Has been cancelled
tests / pyright (3.11) (push) Has been cancelled
tests / pyright (3.12) (push) Has been cancelled
tests / pyright (3.13) (push) Has been cancelled
tests / ty-check (3.10) (push) Has been cancelled
tests / ty-check (3.11) (push) Has been cancelled
tests / ty-check (3.12) (push) Has been cancelled
tests / ty-check (3.13) (push) Has been cancelled
tests / stubs (push) Has been cancelled
tests / smoke-test (push) Has been cancelled
Docker / check_paths (push) Has been cancelled
docs / build (push) Has been cancelled
Docker / build (push) Has been cancelled
Upstream: https://github.com/michaelgillett/mjlab Upstream-Commit: c19f713c415a699a79d71cd96aa13c3104a05047 Upstream-Branch: main
37 lines
1012 B
Python
37 lines
1012 B
Python
"""Smoke test for mjlab package."""
|
|
|
|
import io
|
|
import sys
|
|
import warnings
|
|
from contextlib import redirect_stderr, redirect_stdout
|
|
|
|
try:
|
|
import pytest
|
|
except ModuleNotFoundError:
|
|
pytest = None # type: ignore[assignment]
|
|
|
|
|
|
@pytest.mark.slow if pytest else lambda f: f
|
|
def test_basic_functionality() -> None:
|
|
"""Test that mjlab can create and close an environment."""
|
|
from mjlab.envs.manager_based_rl_env import ManagerBasedRlEnv
|
|
from mjlab.tasks.velocity.config.go1.env_cfgs import unitree_go1_flat_env_cfg
|
|
|
|
# Suppress env spam.
|
|
with warnings.catch_warnings():
|
|
warnings.simplefilter("ignore")
|
|
with redirect_stdout(io.StringIO()), redirect_stderr(io.StringIO()):
|
|
env = ManagerBasedRlEnv(unitree_go1_flat_env_cfg(), device="cpu")
|
|
assert env.sim.data.time == 0.0
|
|
env.close()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
try:
|
|
test_basic_functionality()
|
|
print("✓ Smoke test passed!")
|
|
sys.exit(0)
|
|
except Exception as e:
|
|
print(f"✗ Smoke test failed: {e}")
|
|
sys.exit(1)
|