浏览代码

Fix env_manager test

/develop/sac-apex
Ervin Teng 5 年前
当前提交
d2d88b6a
共有 1 个文件被更改,包括 7 次插入3 次删除
  1. 10
      ml-agents/mlagents/trainers/tests/test_subprocess_env_manager.py

10
ml-agents/mlagents/trainers/tests/test_subprocess_env_manager.py


from mlagents_envs.exception import UnityEnvironmentException
from mlagents.trainers.tests.simple_test_envs import SimpleEnvironment
from mlagents.trainers.stats import StatsReporter
from mlagents.trainers.agent_processor import AgentManagerQueue
from mlagents.trainers.tests.test_simple_rl import (
_check_environment_trains,
PPO_CONFIG,

)
external_brains_mock.return_value = [brain_name]
agent_manager_mock = mock.Mock()
mock_policy = mock.Mock()
agent_manager_mock.policy_queue.get.side_effect = [
mock_policy,
mock_policy,
AgentManagerQueue.Empty(),
]
env_manager.set_agent_manager(brain_name, agent_manager_mock)
step_info_dict = {brain_name: Mock()}

)
# Test policy queue
mock_policy = mock.Mock()
agent_manager_mock.policy_queue.get.return_value = mock_policy
env_manager.advance()
assert env_manager.policies[brain_name] == mock_policy
assert agent_manager_mock.policy == mock_policy

正在加载...
取消
保存