From cfd4ae97d3e829d3e4bd3b53a4c2c2ae92dfb1f2 Mon Sep 17 00:00:00 2001 From: GeWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Fri, 17 Apr 2026 16:55:49 +0800 Subject: [PATCH] =?UTF-8?q?fix(tests):=20=E8=A7=A3=E5=86=B3=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E6=B8=85=E7=90=86=E6=9C=9F=E9=97=B4=E7=9A=84=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E5=88=A0=E9=99=A4=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在YamlConfigLoaderAllOfTests的清理方法中添加try-catch块 - 忽略测试拆解期间的目录删除失败异常 - 防止测试因权限或文件锁定问题而意外失败 --- .../Config/YamlConfigLoaderAllOfTests.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/GFramework.Game.Tests/Config/YamlConfigLoaderAllOfTests.cs b/GFramework.Game.Tests/Config/YamlConfigLoaderAllOfTests.cs index e68d190e..53089b81 100644 --- a/GFramework.Game.Tests/Config/YamlConfigLoaderAllOfTests.cs +++ b/GFramework.Game.Tests/Config/YamlConfigLoaderAllOfTests.cs @@ -60,7 +60,14 @@ public sealed class YamlConfigLoaderAllOfTests if (!string.IsNullOrEmpty(_rootPath) && Directory.Exists(_rootPath)) { - Directory.Delete(_rootPath, true); + try + { + Directory.Delete(_rootPath, true); + } + catch (Exception) + { + // Ignore cleanup failures in test teardown + } } }