Add Windows executable build and locked dependencies
This commit is contained in:
7 files changed
+684
-9
No files matched your search
@@ -0,0 +1,39 @@
|
||||
"""Check frozen-backend collection and guard against accidental cross-builds."""
|
||||
|
||||
import contextlib
|
||||
import io
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
from scripts.build_exe import build_arguments, main
|
||||
|
||||
|
||||
class ExeBuildTests(unittest.TestCase):
|
||||
def test_collects_windows_backend_and_keeps_output_in_project(self):
|
||||
root = Path("fixture-project").resolve()
|
||||
args = build_arguments(root)
|
||||
self.assertIn("--onedir", args)
|
||||
self.assertIn("--windowed", args)
|
||||
self.assertEqual(args[args.index("--collect-submodules") + 1], "bleak.backends.winrt")
|
||||
self.assertEqual(args[args.index("--collect-all") + 1], "winrt")
|
||||
self.assertEqual(args[args.index("--distpath") + 1], str(root / "dist"))
|
||||
self.assertEqual(args[-1], str(root / "controller" / "__main__.py"))
|
||||
|
||||
def test_onefile_and_debug_console_are_explicit(self):
|
||||
args = build_arguments(Path("."), onefile=True, console=True)
|
||||
self.assertIn("--onefile", args)
|
||||
self.assertIn("--console", args)
|
||||
self.assertNotIn("--onedir", args)
|
||||
self.assertNotIn("--windowed", args)
|
||||
|
||||
def test_linux_interpreter_does_not_start_a_build(self):
|
||||
with (
|
||||
patch("scripts.build_exe.sys.platform", "linux"),
|
||||
patch("scripts.build_exe.subprocess.run") as run,
|
||||
contextlib.redirect_stderr(io.StringIO()),
|
||||
):
|
||||
with self.assertRaises(SystemExit) as result:
|
||||
main([])
|
||||
self.assertEqual(result.exception.code, 2)
|
||||
run.assert_not_called()
|
||||
Reference in new issue
Block a user