From f134e91d724043b6bde1263daf8da23f214d63c3 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 12 Sep 2024 15:36:45 +0700 Subject: [PATCH] Check if SLDR cache exists before clearing it out This fixes some further test flakiness I saw locally. --- SIL.WritingSystems.Tests/SldrTests.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SIL.WritingSystems.Tests/SldrTests.cs b/SIL.WritingSystems.Tests/SldrTests.cs index 6c75407b6..62b91d22d 100644 --- a/SIL.WritingSystems.Tests/SldrTests.cs +++ b/SIL.WritingSystems.Tests/SldrTests.cs @@ -60,8 +60,9 @@ public void Dispose() Sldr.Cleanup(); // clear out SLDR cache var di = new DirectoryInfo(sldrCachePath); - foreach (var fi in di.GetFiles()) - fi.Delete(); + if (di.Exists) + foreach (var fi in di.GetFiles()) + fi.Delete(); // The OfflineSldrAttribute has been assigned to the entire test assembly, so we reinitialize // the SLDR back to what it was Sldr.Initialize(true, sldrCachePath);