-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathtest_launch_utils.py
More file actions
77 lines (62 loc) · 2.06 KB
/
Copy pathtest_launch_utils.py
File metadata and controls
77 lines (62 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import importlib.util
from pathlib import Path
import unittest
MODULE_PATH = (
Path(__file__).parents[1]
/ "client"
/ "ayon_photoshop"
/ "api"
/ "launch_utils.py"
)
SPEC = importlib.util.spec_from_file_location("launch_utils", MODULE_PATH)
launch_utils = importlib.util.module_from_spec(SPEC)
SPEC.loader.exec_module(launch_utils)
class GetMacosLaunchArgsTest(unittest.TestCase):
def test_keeps_native_arguments_for_universal_photoshop(self):
args, arch = launch_utils.get_macos_launch_args(
["/Applications/Adobe Photoshop/Photoshop"],
["x86_64", "arm64"],
{"arm64"},
)
self.assertEqual(
args,
["/Applications/Adobe Photoshop/Photoshop"],
)
self.assertIsNone(arch)
def test_uses_rosetta_for_x86_only_photoshop(self):
args, arch = launch_utils.get_macos_launch_args(
["/Applications/Adobe Photoshop/Photoshop", "--flag"],
["x86_64"],
{"arm64"},
)
self.assertEqual(
args,
[
"arch",
"-x86_64",
"/Applications/Adobe Photoshop/Photoshop",
"--flag",
],
)
self.assertEqual(arch, "x86_64")
def test_keeps_arguments_when_architecture_detection_fails(self):
original_args = ["/Applications/Adobe Photoshop/Photoshop"]
args, arch = launch_utils.get_macos_launch_args(
original_args,
[],
{"arm64"},
)
self.assertEqual(args, original_args)
self.assertIsNone(arch)
self.assertIsNot(args, original_args)
def test_keeps_arguments_when_process_architecture_is_unknown(self):
original_args = ["/Applications/Adobe Photoshop/Photoshop"]
args, arch = launch_utils.get_macos_launch_args(
original_args,
["x86_64", "arm64"],
set(),
)
self.assertEqual(args, original_args)
self.assertIsNone(arch)
if __name__ == "__main__":
unittest.main()