diff --git a/scripts/ci/select_unit_tests.py b/scripts/ci/select_unit_tests.py index edc0bb8a2..90f3d50ee 100644 --- a/scripts/ci/select_unit_tests.py +++ b/scripts/ci/select_unit_tests.py @@ -158,10 +158,13 @@ def select_tests(changed_files): source_file_changes = [] for f in changed_files: - # 测试文件本身改动 + # 测试文件本身改动(仅保留仍存在的文件,删除的测试文件不加入运行列表) if f.startswith("tests/unit/test_") and f.endswith(".py"): - test_file_changes.append(f) - selected.add(f) + if (ROOT / f).exists(): + test_file_changes.append(f) + selected.add(f) + else: + print(f"[skip-deleted] 测试文件已删除,跳过: {f}") # 源码文件改动 elif f.endswith(".py"): source_file_changes.append(f)