[fix] restore minimum Xmake version to 3.1.1

This commit is contained in:
dijunkun
2026-10-08 16:26:25 +08:00
parent b0d6e8a520
commit 5004c91a6c
19 changed files with 49 additions and 52 deletions
+7 -8
View File
@@ -18,16 +18,15 @@ class XmakeSelectionTest(unittest.TestCase):
for patcher in (
patch.dict(os.environ, {}, clear=True),
patch.object(build_native.shutil, "which", return_value="/tools/xmake"),
patch.object(build_native.subprocess, "check_output", return_value="xmake v3.0.0\n"),
patch.object(build_native.subprocess, "check_output", return_value="xmake v3.1.1\n"),
):
patcher.start()
self.addCleanup(patcher.stop)
def test_path_tool_accepts_minimum_and_newer_versions(self):
for output in ("xmake v3.0.0", "xmake v3.0.1\n", "xmake v3.0.9\n", "xmake v3.0.99\n",
"xmake v3.1.0\n", "xmake v3.1.1\n", "xmake v3.1.2\n", "xmake v3.1.10, A build utility\n",
for output in ("xmake v3.1.1", "xmake v3.1.2\n", "xmake v3.1.10, A build utility\n",
"xmake v3.2.0\n", "xmake v3.10.0\n", "xmake v4.0.0\n",
"\x1b[1mxmake v3.0.0+HEAD.3ba37a0d4, A build utility\x1b[0m\n"):
"\x1b[1mxmake v3.1.1+HEAD.3ba37a0d4, A build utility\x1b[0m\n"):
with self.subTest(output=output):
build_native.subprocess.check_output.return_value = output
self.assertEqual(build_native.find_xmake(), "/tools/xmake")
@@ -41,16 +40,16 @@ class XmakeSelectionTest(unittest.TestCase):
def test_missing_tool_reports_minimum_requirement(self):
build_native.shutil.which.return_value = None
with self.assertRaisesRegex(SystemExit, "Xmake 3.0.0 or newer is required"):
with self.assertRaisesRegex(SystemExit, "Xmake 3.1.1 or newer is required"):
build_native.find_xmake()
build_native.subprocess.check_output.assert_not_called()
def test_older_or_unrecognized_versions_are_rejected(self):
for output in ("xmake v2.9.9\n", "xmake v2.99.99\n",
"xmake version unknown\n", "xmake v3.0\n", "xmake v3.0.0invalid\n", ""):
for output in ("xmake v3.1.0\n", "xmake v3.0.99\n", "xmake v2.99.99\n",
"xmake version unknown\n", "xmake v3.1\n", "xmake v3.1.1invalid\n", ""):
with self.subTest(output=output):
build_native.subprocess.check_output.return_value = output
with self.assertRaisesRegex(SystemExit, "Use Xmake 3.0.0 or newer"):
with self.assertRaisesRegex(SystemExit, "Use Xmake 3.1.1 or newer"):
build_native.find_xmake()