From 6d8b68cc724c361793ccb309813151a560d0b767 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Mon, 7 Jun 2021 12:59:38 +0800 Subject: [PATCH] Ensure coverage of Xcode run command. --- tests/platforms/macOS/xcode/test_run.py | 37 ++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/tests/platforms/macOS/xcode/test_run.py b/tests/platforms/macOS/xcode/test_run.py index 2a072bded..753825351 100644 --- a/tests/platforms/macOS/xcode/test_run.py +++ b/tests/platforms/macOS/xcode/test_run.py @@ -1 +1,36 @@ -# skip since run uses the same code as app command +# Xcode uses the same run implementation as the base app; +# Run a basic test to ensure coverage, but fall back to +# the app backend for exhaustive tests. +from unittest import mock + +from briefcase.platforms.macOS.xcode import macOSXcodeRunCommand + + +def test_run_app(first_app_config, tmp_path): + "A macOS Xcode app can be started" + command = macOSXcodeRunCommand(base_path=tmp_path) + command.subprocess = mock.MagicMock() + + command.run_app(first_app_config) + + # Calls were made to start the app and to start a log stream. + bin_path = command.binary_path(first_app_config) + command.subprocess.run.assert_has_calls([ + mock.call( + ['open', '-n', str(bin_path)], + check=True + ), + mock.call( + [ + 'log', 'stream', + '--style', 'compact', + '--predicate', + 'senderImagePath=="{sender}"' + ' OR (processImagePath=="{sender}"' + ' AND senderImagePath=="/usr/lib/libffi.dylib")'.format( + sender=bin_path / "Contents" / "MacOS" / "First App" + ) + ], + check=True, + ) + ])