修复:加固 Windows 更新预检、提交点和可恢复的数据库回退流程

This commit is contained in:
2026-11-05 16:54:30 +08:00
parent 2315c83067
commit 3962521a5c
13 changed files with 1821 additions and 236 deletions
+2 -3
View File
@@ -54,10 +54,9 @@ class WindowsCacheRepairTest(unittest.TestCase):
patch.object(control.subprocess, 'run', return_value=subprocess.CompletedProcess([], 0)):
control.verify()
def test_actual_startup_hash_check_fails_on_regenerated_cache_then_passes_after_repair(self):
def test_startup_accepts_regenerated_cache_only_when_source_hash_is_valid(self):
(self.root / self.cache).write_bytes(b'new-bytecode-created-on-windows')
with self.assertRaisesRegex(RuntimeError, '__future__.*pyc'):
self.verify()
self.verify() # 合法源码允许运行库重建缓存;原位修复仍可清除旧缓存清单。
result = fix.repair(self.root)
self.assertEqual(result['cacheEntriesRemoved'], 1)
self.verify()