MCPcopy Index your code
hub / github.com/python/cpython / select_simulator_device

Function select_simulator_device

Platforms/Apple/testbed/__main__.py:29–60  ·  view source on GitHub ↗
(platform)

Source from the content-addressed store, hash-verified

27
28# Select a simulator device to use.
29def select_simulator_device(platform):
30 # List the testing simulators, in JSON format
31 raw_json = subprocess.check_output(["xcrun", "simctl", "list", "-j"])
32 json_data = json.loads(raw_json)
33
34 if platform == "iOS":
35 # Any iOS device will do; we'll look for "SE" devices - but the name
36 # isn't consistent over time. Older Xcode versions will use "iPhone SE
37 # (Nth generation)"; As of 2025, they've started using "iPhone 16e".
38 #
39 # When Xcode is updated after a new release, new devices will be
40 # available and old ones will be dropped from the set available on the
41 # latest iOS version. Select the one with the highest minimum runtime
42 # version - this is an indicator of the "newest" released device, which
43 # should always be supported on the "most recent" iOS version.
44 se_simulators = sorted(
45 (devicetype["minRuntimeVersion"], devicetype["name"])
46 for devicetype in json_data["devicetypes"]
47 if devicetype["productFamily"] == "iPhone"
48 and (
49 (
50 "iPhone " in devicetype["name"]
51 and devicetype["name"].endswith("e")
52 )
53 or "iPhone SE " in devicetype["name"]
54 )
55 )
56 simulator = se_simulators[-1][1]
57 else:
58 raise ValueError(f"Unknown platform {platform}")
59
60 return simulator
61
62
63def xcode_test(location: Path, platform: str, simulator: str, verbose: bool):

Callers 1

run_testbedFunction · 0.85

Calls 3

check_outputMethod · 0.45
loadsMethod · 0.45
endswithMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…