您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
30 行
899 B
30 行
899 B
import pytest
|
|
|
|
from mlagents.envs import RpcCommunicator
|
|
from mlagents.envs import UnityWorkerInUseException
|
|
|
|
|
|
def test_rpc_communicator_checks_port_on_create():
|
|
first_comm = RpcCommunicator()
|
|
with pytest.raises(UnityWorkerInUseException):
|
|
second_comm = RpcCommunicator()
|
|
second_comm.close()
|
|
first_comm.close()
|
|
|
|
|
|
def test_rpc_communicator_close():
|
|
# Ensures it is possible to open a new RPC Communicators
|
|
# after closing one on the same worker_id
|
|
first_comm = RpcCommunicator()
|
|
first_comm.close()
|
|
second_comm = RpcCommunicator()
|
|
second_comm.close()
|
|
|
|
|
|
def test_rpc_communicator_create_multiple_workers():
|
|
# Ensures multiple RPC communicators can be created with
|
|
# different worker_ids without causing an error.
|
|
first_comm = RpcCommunicator()
|
|
second_comm = RpcCommunicator(worker_id=1)
|
|
first_comm.close()
|
|
second_comm.close()
|