build: 增加 exe 打包脚本与版本信息,修复子目录卷信息查询

- tools/build_exe.ps1:一条命令出 dist\\U盘备份工具.exe(onefile/windowed/图标/版本信息),并打印 SHA-256
- tools/version_info.txt:2.1.0.0 版本资源
- get_volume_info 统一换算到卷根再查询:传子目录/文件也能拿到文件系统,修复 FAT32 4GB 上限与脏卷提示依赖 vol['fs'] 失效的问题
- 新增 2 项体积/卷信息测试(共 32 项)
This commit is contained in:
admin committed 2026-10-29 14:41:34 +08:00
1 parent 8232b18c9f
commit 550bfaaa00
5 files changed
+106 -9

No files matched your search

+22
View File
@@ -71,6 +71,28 @@ class TestBackupDirFor(unittest.TestCase):
self.assertEqual(path, new)
class TestVolumeInfo(unittest.TestCase):
def test_subdirectory_resolves_volume(self):
d = tempfile.mkdtemp(prefix="vol-")
try:
info = ub.get_volume_info(d)
self.assertIn(info["fs"], ("NTFS", "FAT32", "exFAT", "ReFS", "FAT16", "FAT"))
self.assertGreater(info["total"], 0)
self.assertGreaterEqual(info["free"], 0)
finally:
shutil.rmtree(d, ignore_errors=True)
def test_file_path_resolves_volume(self):
d = tempfile.mkdtemp(prefix="vol-")
try:
f = os.path.join(d, "a.txt")
with open(f, "wb") as fh:
fh.write(b"x")
self.assertEqual(ub.get_volume_info(f)["fs"], ub.get_volume_info(d)["fs"])
finally:
shutil.rmtree(d, ignore_errors=True)
class TestConfig(unittest.TestCase):
def setUp(self):
self.dir = tempfile.mkdtemp(prefix="cfg-")