-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
Showing
7 changed files
with
188 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
55 changes: 55 additions & 0 deletions
55
com.unity.ml-agents/Tests/Editor/Communicator/RpcCommunicatorTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
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)); | ||
|
||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
com.unity.ml-agents/Tests/Editor/Communicator/RpcCommunicatorTests.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters