ManiSkill icon indicating copy to clipboard operation
ManiSkill copied to clipboard

PyTest can't reliably test all tests in one go

Open StoneT2000 opened this issue 2 years ago • 0 comments

When running all tests, sometimes I get

FAILED tests/test_wrappers.py::test_recordepisode_wrapper[state_dict-PickSingleEGAD-v0] - RuntimeError: Renderer is not created. Renderer creation is required before any other operation.

When testing just the test_wrappers pytests, it works fine. But when combined with other tests in one go, it reports these errors.

___________________________________________________ test_recordepisode_wrapper[state_dict-PickSingleEGAD-v0] ___________________________________________________

env_id = 'PickSingleEGAD-v0', obs_mode = 'state_dict'

    @pytest.mark.parametrize("env_id", ENV_IDS)
    @pytest.mark.parametrize("obs_mode", OBS_MODES)
    def test_recordepisode_wrapper(env_id, obs_mode):
>       env = gym.make(
            env_id, obs_mode=obs_mode, render_mode="cameras", max_episode_steps=20
        )

tests/test_wrappers.py:11: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/stao/mambaforge/envs/ms2-0.5.0/lib/python3.9/site-packages/gymnasium/envs/registration.py:801: in make
    env = env_creator(**env_spec_kwargs)
mani_skill2/utils/registration.py:92: in make
    env = env_spec.make(**kwargs)
mani_skill2/utils/registration.py:34: in make
    return self.cls(**_kwargs)
mani_skill2/envs/pick_and_place/pick_single.py:69: in __init__
    super().__init__(**kwargs)
mani_skill2/envs/pick_and_place/base_env.py:27: in __init__
    super().__init__(*args, **kwargs)
mani_skill2/envs/sapien_env.py:188: in __init__
    obs, _ = self.reset(seed=2022, options=dict(reconfigure=True))
mani_skill2/envs/pick_and_place/pick_single.py:96: in reset
    return super().reset(seed=self._episode_seed, options=options)
mani_skill2/envs/sapien_env.py:479: in reset
    self.reconfigure()
mani_skill2/envs/sapien_env.py:362: in reconfigure
    self._load_agent()
mani_skill2/envs/pick_and_place/base_env.py:70: in _load_agent
    set_articulation_render_material(self.agent.robot, specular=0.9, roughness=0.3)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

articulation = <sapien.core.pysapien.Articulation object at 0x7f491c1bdbb0>, kwargs = {'roughness': 0.3, 'specular': 0.9}
link = Actor(name="panda_link0", id="1"), b = <sapien.core.pysapien.VulkanRigidbody object at 0x7f49dbee61b0>

    def set_articulation_render_material(articulation: sapien.Articulation, **kwargs):
        for link in articulation.get_links():
            for b in link.get_visual_bodies():
>               for s in b.get_render_shapes():
E               RuntimeError: Renderer is not created. Renderer creation is required before any other operation.

mani_skill2/utils/sapien_utils.py:350: RuntimeError

StoneT2000 avatar Aug 03 '23 22:08 StoneT2000