Fail closed when Rayforge runtime is missing
This commit is contained in:
parent
583540a90c
commit
5945bb0b61
2 changed files with 28 additions and 15 deletions
|
|
@ -11,6 +11,7 @@ from pathlib import Path
|
||||||
def inspect(rayforge: Path, python_env: Path) -> dict[str, object]:
|
def inspect(rayforge: Path, python_env: Path) -> dict[str, object]:
|
||||||
msys2_shell = Path("C:/msys64/msys2_shell.cmd")
|
msys2_shell = Path("C:/msys64/msys2_shell.cmd")
|
||||||
msys2_env = rayforge / ".msys2_env"
|
msys2_env = rayforge / ".msys2_env"
|
||||||
|
if python_env.is_file():
|
||||||
gi_probe = subprocess.run(
|
gi_probe = subprocess.run(
|
||||||
[str(python_env), "-c", "import gi"],
|
[str(python_env), "-c", "import gi"],
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
|
|
@ -26,6 +27,9 @@ def inspect(rayforge: Path, python_env: Path) -> dict[str, object]:
|
||||||
),
|
),
|
||||||
"unable to import gi",
|
"unable to import gi",
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
gi_available = False
|
||||||
|
gi_error = "python runtime not found"
|
||||||
app_entry = rayforge / "rayforge" / "__main__.py"
|
app_entry = rayforge / "rayforge" / "__main__.py"
|
||||||
addon_manifest = (
|
addon_manifest = (
|
||||||
Path(__file__).parents[1]
|
Path(__file__).parents[1]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
import json
|
import json
|
||||||
import unittest
|
import unittest
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import tempfile
|
||||||
|
|
||||||
|
from scripts.check_rayforge_windows_gui import inspect
|
||||||
|
|
||||||
|
|
||||||
ROOT = Path(__file__).parents[1]
|
ROOT = Path(__file__).parents[1]
|
||||||
|
|
@ -30,6 +33,12 @@ class RayforgeWindowsGuiPreflightTests(unittest.TestCase):
|
||||||
def test_result_records_the_requested_runtime_probe(self):
|
def test_result_records_the_requested_runtime_probe(self):
|
||||||
self.assertIn("No module named 'gi'", self.result["observed_launch_error"])
|
self.assertIn("No module named 'gi'", self.result["observed_launch_error"])
|
||||||
|
|
||||||
|
def test_missing_runtime_path_fails_closed(self):
|
||||||
|
with tempfile.TemporaryDirectory() as temporary:
|
||||||
|
result = inspect(Path(temporary), Path(temporary) / "missing-python.exe")
|
||||||
|
self.assertFalse(result["ready_for_manual_gui_test"])
|
||||||
|
self.assertEqual("python runtime not found", result["observed_launch_error"])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue