From 2ec7dc21ed1f4c297dfe7b3be1fa3e57d9137aab Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 5 Sep 2024 16:16:57 +0700 Subject: [PATCH] Checking if Sldr is initialized before each test in SldrTests This may possibly fix some test flakiness with Sldr. The initialize is also present in the TestEnvironment, but this isn't constructed in every test. By initializing in the SetUp, we guarantee it is. Certainly tests outside this class have been flaky, but I haven't seen any failures in 4-5 runs with this fix. --- SIL.WritingSystems.Tests/SldrTests.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/SIL.WritingSystems.Tests/SldrTests.cs b/SIL.WritingSystems.Tests/SldrTests.cs index cff4632a7..6c75407b6 100644 --- a/SIL.WritingSystems.Tests/SldrTests.cs +++ b/SIL.WritingSystems.Tests/SldrTests.cs @@ -68,6 +68,13 @@ public void Dispose() } } + [SetUp] + public void Setup() + { + if (!Sldr.IsInitialized) + Sldr.Initialize(true, Sldr.DefaultSldrCachePath); + } + [Test] public void GetLdmlFile_EmptyPath_Throws() {