2022-09-26 08:39:54 +02:00
|
|
|
from typing import Tuple
|
2021-08-19 09:30:54 +02:00
|
|
|
|
2022-09-26 08:39:54 +02:00
|
|
|
import fancy_gym
|
2022-09-23 09:40:35 +02:00
|
|
|
import pytest
|
|
|
|
from dm_control import suite, manipulation
|
2021-08-19 09:30:54 +02:00
|
|
|
|
2022-09-26 08:39:54 +02:00
|
|
|
from test.utils import run_env_determinism, run_env
|
|
|
|
|
|
|
|
SUITE_IDS = [f'dmc:{env}-{task}' for env, task in suite.ALL_TASKS if env != "lqr"]
|
|
|
|
MANIPULATION_IDS = [f'dmc:manipulation-{task}' for task in manipulation.ALL if task.endswith('_features')]
|
2021-08-19 09:30:54 +02:00
|
|
|
SEED = 1
|
|
|
|
|
|
|
|
|
2022-09-26 08:39:54 +02:00
|
|
|
@pytest.mark.parametrize('env_id', SUITE_IDS)
|
|
|
|
def test_step_suite_functionality(env_id: str):
|
|
|
|
"""Tests that suite step environments run without errors using random actions."""
|
|
|
|
run_env(env_id)
|
2021-08-19 09:30:54 +02:00
|
|
|
|
|
|
|
|
2022-09-26 08:39:54 +02:00
|
|
|
@pytest.mark.parametrize('env_id', SUITE_IDS)
|
|
|
|
def test_step_suite_determinism(env_id: str):
|
|
|
|
"""Tests that for step environments identical seeds produce identical trajectories."""
|
2022-09-23 09:40:35 +02:00
|
|
|
seed = 0
|
2022-09-26 08:39:54 +02:00
|
|
|
run_env_determinism(env_id, seed)
|
2021-08-19 09:30:54 +02:00
|
|
|
|
|
|
|
|
2022-09-26 08:39:54 +02:00
|
|
|
@pytest.mark.parametrize('env_id', MANIPULATION_IDS)
|
|
|
|
def test_step_manipulation_functionality(env_id: str):
|
|
|
|
"""Tests that manipulation step environments run without errors using random actions."""
|
|
|
|
run_env(env_id)
|
2021-08-19 09:30:54 +02:00
|
|
|
|
|
|
|
|
2022-09-26 08:39:54 +02:00
|
|
|
@pytest.mark.parametrize('env_id', MANIPULATION_IDS)
|
|
|
|
def test_step_manipulation_determinism(env_id: str):
|
|
|
|
"""Tests that for step environments identical seeds produce identical trajectories."""
|
2022-09-23 09:40:35 +02:00
|
|
|
seed = 0
|
2022-09-26 08:39:54 +02:00
|
|
|
run_env_determinism(env_id, seed)
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize('env_id', [fancy_gym.ALL_DMC_MOVEMENT_PRIMITIVE_ENVIRONMENTS.values()])
|
|
|
|
def test_bb_dmc_functionality(env_id: str):
|
|
|
|
"""Tests that black box environments run without errors using random actions."""
|
|
|
|
run_env(env_id)
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize('env_id', [fancy_gym.ALL_DMC_MOVEMENT_PRIMITIVE_ENVIRONMENTS.values()])
|
|
|
|
def test_bb_dmc_determinism(env_id: str):
|
|
|
|
"""Tests that for black box environment identical seeds produce identical trajectories."""
|
|
|
|
run_env_determinism(env_id)
|