Document successful iOS CI and simulator regression checks [skip ci]
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import json
|
||||
import pathlib
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
|
||||
class SimulatorSelectionTests(unittest.TestCase):
|
||||
def select(self, devices, sdk):
|
||||
with tempfile.TemporaryDirectory() as folder:
|
||||
path = pathlib.Path(folder) / "devices.json"
|
||||
path.write_text(json.dumps({"devices": devices}), encoding="utf-8")
|
||||
return subprocess.run([sys.executable, str(pathlib.Path(__file__).with_name("select_simulator.py")), str(path), sdk],
|
||||
capture_output=True, text=True)
|
||||
|
||||
def test_matches_sdk_and_preserves_id(self):
|
||||
expected = "DC4CD8B3-4457-4153-9087-A0D7A2F9BFD9"
|
||||
result = self.select({
|
||||
"com.apple.CoreSimulator.SimRuntime.iOS-26-2": [{"name": "iPhone 17", "isAvailable": True, "udid": "E952A9B0-CC78-435C-BF08-06AD47FE1076"}],
|
||||
"com.apple.CoreSimulator.SimRuntime.iOS-18-5": [{"name": "iPhone 16 Pro", "isAvailable": True, "udid": expected}],
|
||||
}, "18.5")
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
self.assertEqual(result.stdout.strip(), "SIMULATOR_ID=" + expected)
|
||||
|
||||
def test_fails_when_sdk_has_no_available_iphone(self):
|
||||
result = self.select({"com.apple.CoreSimulator.SimRuntime.iOS-18-5": [
|
||||
{"name": "iPad", "isAvailable": True, "udid": "DC4CD8B3-4457-4153-9087-A0D7A2F9BFD9"},
|
||||
{"name": "iPhone 16", "isAvailable": False, "udid": "E952A9B0-CC78-435C-BF08-06AD47FE1076"},
|
||||
]}, "18.5")
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertEqual(result.stdout, "")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user