forked from beeware/briefcase
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor macOS Run to share implementation between app and Xcode
- Loading branch information
1 parent
b60e1f1
commit c60f2a0
Showing
5 changed files
with
68 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# skip since packing uses the same code as app command | ||
# skip since packaging uses the same code as app command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1 @@ | ||
import subprocess | ||
from unittest import mock | ||
|
||
import pytest | ||
|
||
from briefcase.exceptions import BriefcaseCommandError | ||
from briefcase.platforms.macOS.xcode import macOSXcodeRunCommand | ||
|
||
|
||
def test_run_app(first_app_config, tmp_path): | ||
"A macOS App can be started" | ||
command = macOSXcodeRunCommand(base_path=tmp_path) | ||
command.subprocess = mock.MagicMock() | ||
|
||
command.run_app(first_app_config) | ||
|
||
command.subprocess.run.assert_called_with( | ||
['open', str(command.binary_path(first_app_config))], | ||
check=True | ||
) | ||
|
||
|
||
def test_run_app_failed(first_app_config, tmp_path): | ||
"If there's a problem started the app, an exception is raised" | ||
command = macOSXcodeRunCommand(base_path=tmp_path) | ||
command.subprocess = mock.MagicMock() | ||
command.subprocess.run.side_effect = subprocess.CalledProcessError( | ||
cmd=['open', str(command.binary_path(first_app_config))], | ||
returncode=1 | ||
) | ||
|
||
with pytest.raises(BriefcaseCommandError): | ||
command.run_app(first_app_config) | ||
|
||
# The run command was still invoked, though | ||
command.subprocess.run.assert_called_with( | ||
['open', str(command.binary_path(first_app_config))], | ||
check=True | ||
) | ||
# skip since run uses the same code as app command |