Debian Codegraph @

tests/platforms/windows/visualstudio/test_open.py

raw
1 import os
2 import sys
3 from unittest.mock import MagicMock
4
5 import pytest
6
7 from briefcase.integrations.subprocess import Subprocess
8 from briefcase.platforms.windows.visualstudio import WindowsVisualStudioOpenCommand
9
10 from ....utils import create_file
11
12
13 @pytest.fixture
14 def open_command(dummy_console, tmp_path, first_app_config):
15 command = WindowsVisualStudioOpenCommand(
16 console=dummy_console,
17 base_path=tmp_path / "base_path",
18 data_path=tmp_path / "briefcase",
19 )
20 command.tools.os = MagicMock(spec_set=os)
21 command.tools.subprocess = MagicMock(spec_set=Subprocess)
22 return command
23
24
25 @pytest.mark.skipif(sys.platform != "win32", reason="Windows specific test")
26 def test_open(open_command, first_app_config, tmp_path):
27 """Open command opens visual studio project file."""
28 # Create the solution file that would be in the created project.
29 create_file(open_command.project_path(first_app_config), "Visual Studio Solution")
30
31 open_command(first_app_config)
32
33 open_command.tools.os.startfile.assert_called_once_with(
34 tmp_path
35 / "base_path"
36 / "build"
37 / "first-app"
38 / "windows"
39 / "visualstudio"
40 / "First App.sln"
41 )