From ae9fa9b84ee1e3cf0f803cc700bba7eae3a26cfa Mon Sep 17 00:00:00 2001 From: Chris Busillo Date: Wed, 12 Aug 2026 12:32:28 -0400 Subject: [PATCH 1/2] Test App Store review platform parsing --- Tests/ScriptsTests/test_release_workflows.py | 1 - .../test_submit_app_store_review.py | 47 ++++++++++++++++++- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/Tests/ScriptsTests/test_release_workflows.py b/Tests/ScriptsTests/test_release_workflows.py index a9ad56e..b39a49a 100644 --- a/Tests/ScriptsTests/test_release_workflows.py +++ b/Tests/ScriptsTests/test_release_workflows.py @@ -1189,7 +1189,6 @@ def test_app_store_review_workflow_supports_tvos(self): release_docs = self.read("docs/release.md") self.assertIn("- TV_OS", workflow) - self.assertIn('choices=("IOS", "MAC_OS", "TV_OS", "VISION_OS")', script) self.assertIn("tvos_demo_video_url:", workflow) self.assertIn("INPUT_TVOS_DEMO_VIDEO_URL", workflow) self.assertIn('args+=(--tvos-demo-video-url "${INPUT_TVOS_DEMO_VIDEO_URL}")', workflow) diff --git a/Tests/ScriptsTests/test_submit_app_store_review.py b/Tests/ScriptsTests/test_submit_app_store_review.py index 57afba2..fc574ce 100644 --- a/Tests/ScriptsTests/test_submit_app_store_review.py +++ b/Tests/ScriptsTests/test_submit_app_store_review.py @@ -6,7 +6,7 @@ import urllib.error import sys from unittest.mock import patch -from contextlib import redirect_stdout +from contextlib import redirect_stderr, redirect_stdout from pathlib import Path from types import SimpleNamespace from typing import Any @@ -597,6 +597,51 @@ def request(self, method, path, params=None, body=None, allowed=(200,)): return super().request(method, path, params, body, allowed) +class PlatformArgumentTests(unittest.TestCase): + def parse(self, *arguments: str): + with patch.object( + sys, + "argv", + ["submit-app-store-review.py", "--version", "1.0.54", *arguments], + ): + return submit_app_store_review.parse_args() + + def assert_rejected(self, *arguments: str) -> str: + error_output = io.StringIO() + with redirect_stderr(error_output), self.assertRaises(SystemExit) as context: + self.parse(*arguments) + self.assertEqual(context.exception.code, 2) + return error_output.getvalue() + + def test_platform_accepts_every_platform_with_runtime_requirements(self): + for platform in submit_app_store_review.REQUIRED_RUNTIME_SURFACES_BY_PLATFORM: + with self.subTest(platform=platform): + self.assertEqual(self.parse("--platform", platform).platform, platform) + + def test_platform_defaults_to_mac_os(self): + self.assertEqual(self.parse().platform, "MAC_OS") + + def test_platform_rejects_unsupported_miscased_and_empty_values(self): + for platform in ("WATCH_OS", "ios", ""): + with self.subTest(platform=platform): + self.assertIn("--platform", self.assert_rejected("--platform", platform)) + + def test_copy_from_platform_defaults_to_none_and_accepts_supported_platforms(self): + self.assertIsNone(self.parse().copy_from_platform) + for platform in submit_app_store_review.REQUIRED_RUNTIME_SURFACES_BY_PLATFORM: + with self.subTest(platform=platform): + self.assertEqual( + self.parse("--copy-from-platform", platform).copy_from_platform, + platform, + ) + + def test_copy_from_platform_rejects_unsupported_platforms(self): + self.assertIn( + "--copy-from-platform", + self.assert_rejected("--copy-from-platform", "WATCH_OS"), + ) + + class MetadataSourcePlatformTests(unittest.TestCase): def test_copy_from_platform_defaults_to_target_platform(self): args = SimpleNamespace(platform="TV_OS", copy_from_platform=None) From ed3469aab92d274b9c7a28d6660703f2842f2f99 Mon Sep 17 00:00:00 2001 From: Chris Busillo Date: Wed, 12 Aug 2026 12:36:58 -0400 Subject: [PATCH 2/2] Tighten platform parser diagnostics --- Tests/ScriptsTests/test_submit_app_store_review.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Tests/ScriptsTests/test_submit_app_store_review.py b/Tests/ScriptsTests/test_submit_app_store_review.py index fc574ce..b605d62 100644 --- a/Tests/ScriptsTests/test_submit_app_store_review.py +++ b/Tests/ScriptsTests/test_submit_app_store_review.py @@ -624,7 +624,10 @@ def test_platform_defaults_to_mac_os(self): def test_platform_rejects_unsupported_miscased_and_empty_values(self): for platform in ("WATCH_OS", "ios", ""): with self.subTest(platform=platform): - self.assertIn("--platform", self.assert_rejected("--platform", platform)) + self.assertIn( + "argument --platform:", + self.assert_rejected("--platform", platform), + ) def test_copy_from_platform_defaults_to_none_and_accepts_supported_platforms(self): self.assertIsNone(self.parse().copy_from_platform) @@ -637,7 +640,7 @@ def test_copy_from_platform_defaults_to_none_and_accepts_supported_platforms(sel def test_copy_from_platform_rejects_unsupported_platforms(self): self.assertIn( - "--copy-from-platform", + "argument --copy-from-platform:", self.assert_rejected("--copy-from-platform", "WATCH_OS"), )