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
|
from unittest import mock
import pytest
import briefcase.integrations.xcode
from briefcase.platforms.macOS.xcode import macOSXcodePackageCommand
# skip most tests since packaging uses the same code as app command
@pytest.fixture
def package_command(dummy_console, tmp_path):
command = macOSXcodePackageCommand(
console=dummy_console,
base_path=tmp_path / "base_path",
data_path=tmp_path / "briefcase",
)
return command
def test_verify(package_command, monkeypatch):
"""If you're on macOS, you can verify tools."""
package_command.tools.host_os = "Darwin"
mock_ensure_xcode_is_installed = mock.MagicMock()
monkeypatch.setattr(
briefcase.integrations.xcode.Xcode,
"ensure_xcode_is_installed",
mock_ensure_xcode_is_installed,
)
mock_ensure_command_line_tools_are_installed = mock.MagicMock()
monkeypatch.setattr(
briefcase.integrations.xcode.XcodeCliTools,
"ensure_command_line_tools_are_installed",
mock_ensure_command_line_tools_are_installed,
)
mock_confirm_xcode_license_accepted = mock.MagicMock()
monkeypatch.setattr(
briefcase.integrations.xcode.XcodeCliTools,
"confirm_xcode_license_accepted",
mock_confirm_xcode_license_accepted,
)
package_command.verify_tools()
assert package_command.tools.xcode_cli is not None
mock_ensure_xcode_is_installed.assert_called_once_with(
tools=package_command.tools,
min_version=(13, 0, 0),
)
mock_ensure_command_line_tools_are_installed.assert_called_once_with(
tools=package_command.tools
)
mock_confirm_xcode_license_accepted.assert_called_once_with(
tools=package_command.tools
)
|