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
|
# The package command inherits most of its behavior from the common base
# implementation. Do a surface-level verification here, but the app
# tests provide the actual test coverage.
from unittest import mock
import pytest
from briefcase.integrations.subprocess import Subprocess
from briefcase.integrations.wix import WiX
from briefcase.platforms.windows.visualstudio import WindowsVisualStudioPackageCommand
from ....integrations.wix.conftest import WIX_EXE_PATH, WIX_UI_PATH
@pytest.fixture
def package_command(dummy_console, tmp_path):
command = WindowsVisualStudioPackageCommand(
console=dummy_console,
base_path=tmp_path / "base_path",
data_path=tmp_path / "briefcase",
)
command.tools.subprocess = mock.MagicMock(spec_set=Subprocess)
command.tools.wix = WiX(command.tools, wix_home=tmp_path / "wix")
return command
def test_package_msi(package_command, first_app_config, tmp_path):
"""A Windows app can be packaged as an MSI."""
package_command.package_app(first_app_config)
assert package_command.tools.subprocess.run.mock_calls == [
# Compile MSI
mock.call(
[
tmp_path / "wix" / WIX_EXE_PATH,
"build",
"-ext",
tmp_path / "wix" / WIX_UI_PATH,
"-arch",
"x64",
"first-app.wxs",
"-loc",
"unicode.wxl",
"-o",
tmp_path / "base_path/dist/First App-0.0.1.msi",
],
check=True,
cwd=tmp_path / "base_path/build/first-app/windows/visualstudio",
),
]
|