浏览代码
Use SemVer to check communication compatibility between C# and Python (#3760)
Use SemVer to check communication compatibility between C# and Python (#3760)
* [communication] Use semantic versioning to test communication compatibility between C# and Python. - Add tests for the change. Co-authored-by: Chris Elion <chris.elion@unity3d.com>/develop/add-fire
GitHub
5 年前
当前提交
989cc89f
共有 8 个文件被更改,包括 188 次插入 和 19 次删除
-
1com.unity.ml-agents/CHANGELOG.md
-
51com.unity.ml-agents/Runtime/Communicator/RpcCommunicator.cs
-
63ml-agents-envs/mlagents_envs/environment.py
-
31ml-agents-envs/mlagents_envs/tests/test_envs.py
-
3com.unity.ml-agents/Tests/Editor/Communicator.meta
-
55com.unity.ml-agents/Tests/Editor/Communicator/RpcCommunicatorTests.cs
-
3com.unity.ml-agents/Tests/Editor/Communicator/RpcCommunicatorTests.cs.meta
|
|||
fileFormatVersion: 2 |
|||
guid: da8f640243c749388a0329393c8fce64 |
|||
timeCreated: 1586386315 |
|
|||
using System; |
|||
using System.Collections; |
|||
using System.Text.RegularExpressions; |
|||
using NUnit.Framework; |
|||
using UnityEngine; |
|||
using UnityEngine.TestTools; |
|||
|
|||
namespace MLAgents.Tests.Communicator |
|||
{ |
|||
[TestFixture] |
|||
public class RpcCommunicatorTests |
|||
{ |
|||
|
|||
[Test] |
|||
public void TestCheckCommunicationVersionsAreCompatible() |
|||
{ |
|||
var unityVerStr = "1.0.0"; |
|||
var pythonVerStr = "1.0.0"; |
|||
var pythonPackageVerStr = "0.16.0"; |
|||
|
|||
Assert.IsTrue(RpcCommunicator.CheckCommunicationVersionsAreCompatible(unityVerStr, |
|||
pythonVerStr, |
|||
pythonPackageVerStr)); |
|||
LogAssert.NoUnexpectedReceived(); |
|||
|
|||
pythonVerStr = "1.1.0"; |
|||
Assert.IsTrue(RpcCommunicator.CheckCommunicationVersionsAreCompatible(unityVerStr, |
|||
pythonVerStr, |
|||
pythonPackageVerStr)); |
|||
|
|||
// Ensure that a warning was printed.
|
|||
LogAssert.Expect(LogType.Warning, new Regex("(.\\s)+")); |
|||
|
|||
unityVerStr = "2.0.0"; |
|||
Assert.IsFalse(RpcCommunicator.CheckCommunicationVersionsAreCompatible(unityVerStr, |
|||
pythonVerStr, |
|||
pythonPackageVerStr)); |
|||
|
|||
unityVerStr = "0.15.0"; |
|||
pythonVerStr = "0.15.0"; |
|||
Assert.IsTrue(RpcCommunicator.CheckCommunicationVersionsAreCompatible(unityVerStr, |
|||
pythonVerStr, |
|||
pythonPackageVerStr)); |
|||
unityVerStr = "0.16.0"; |
|||
Assert.IsFalse(RpcCommunicator.CheckCommunicationVersionsAreCompatible(unityVerStr, |
|||
pythonVerStr, |
|||
pythonPackageVerStr)); |
|||
unityVerStr = "1.15.0"; |
|||
Assert.IsFalse(RpcCommunicator.CheckCommunicationVersionsAreCompatible(unityVerStr, |
|||
pythonVerStr, |
|||
pythonPackageVerStr)); |
|||
|
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 251fab8dff424abb95b2b381c7c924c3 |
|||
timeCreated: 1586386329 |
撰写
预览
正在加载...
取消
保存
Reference in new issue