liortal
November 10, 2020, 8:38am
1
In my test fixture, i have this method which causes an exception (Unity 2019.4.13):
[OneTimeTearDown]
public void DisposeTest()
{
LogAssert.ignoreFailingMessages = false;
}
This code seems to cause an exception:
ImageToTextureTests (28.182s)
TearDown : System.InvalidOperationException : No log scope is available
–TearDown
at UnityEngine.TestTools.Logging.LogScope.get_Current () [0x00012] in /Users/liortal/Repos/Work/BlastMaster/Library/PackageCache/com.unity.test-framework@1.1.18/UnityEngine.TestRunner/Assertions/LogScope/LogScope.cs:31
at UnityEngine.TestTools.LogAssert.set_ignoreFailingMessages (System.Boolean value) [0x00001] in /Users/liortal/Repos/Work/BlastMaster/Library/PackageCache/com.unity.test-framework@1.1.18/UnityEngine.TestRunner/Assertions/LogAssert.cs:31
at ImageToTextureTests.DisposeTest () [0x00001] in /Users/liortal/Repos/Work/BlastMaster/Assets/_PM/PetCore/Editor/Tests/ImageToTextureTests.cs:16
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[ ],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[ ] parameters, System.Globalization.CultureInfo culture) [0x00032] in <9577ac7a62ef43179789031239ba8798>:0
Is this a known bug ?
Thanks for mentioning it. It is not a known bug. I have added a fix for it, which should land in either 1.1.19 or 1.1.20 of the test framework package.
This is still a problem with Unity 2021.1.16f and “com.unity.test-framework”: “1.1.31”.
Setting LogAssert.ignoreFailingMessages = false; at the end of the test doesn’t help either, then the TearDown still fails when it sees an error.