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.
Merge remote-tracking branch 'upstream/master'
- Loading branch information
Showing
16 changed files
with
451 additions
and
92 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
On macOS, iOS, and Android, ``briefcase run`` now displays the application logs once the application has started. |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Dropped the Jinja2 version pin as Python 3.5 is no longer supported. |
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
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import subprocess | ||
from unittest.mock import MagicMock | ||
|
||
import pytest | ||
|
||
from briefcase.exceptions import BriefcaseCommandError, InvalidDeviceError | ||
from briefcase.integrations.android_sdk import ADB | ||
|
||
|
||
def test_clear_log(mock_sdk, capsys): | ||
"Invoking `clear_log()` calls `run()` with the appropriate parameters." | ||
# Mock out the run command on an adb instance | ||
adb = ADB(mock_sdk, "exampleDevice") | ||
adb.run = MagicMock(return_value="example normal adb output") | ||
|
||
# Invoke clear_log | ||
adb.clear_log() | ||
|
||
# Validate call parameters. | ||
adb.run.assert_called_once_with("logcat", "-c") | ||
|
||
# Validate that the normal output of the command was not printed (since there | ||
# was no error). | ||
assert "normal adb output" not in capsys.readouterr() | ||
|
||
|
||
def test_adb_failure(mock_sdk): | ||
"If adb logcat fails, the error is caught." | ||
# Mock out the run command on an adb instance | ||
adb = ADB(mock_sdk, "exampleDevice") | ||
adb.run = MagicMock(side_effect=subprocess.CalledProcessError( | ||
returncode=1, cmd='adb logcat' | ||
)) | ||
|
||
with pytest.raises(BriefcaseCommandError): | ||
adb.clear_log() | ||
|
||
|
||
def test_invalid_device(mock_sdk): | ||
"If the device doesn't exist, the error is caught." | ||
# Use real `adb` output from launching an activity that does not exist. | ||
# Mock out the run command on an adb instance | ||
adb = ADB(mock_sdk, "exampleDevice") | ||
adb.run = MagicMock(side_effect=InvalidDeviceError('device', 'exampleDevice')) | ||
|
||
with pytest.raises(InvalidDeviceError): | ||
adb.clear_log() |
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import os | ||
import subprocess | ||
from unittest.mock import MagicMock | ||
|
||
import pytest | ||
|
||
from briefcase.exceptions import BriefcaseCommandError | ||
from briefcase.integrations.android_sdk import ADB | ||
|
||
|
||
def test_logcat(mock_sdk): | ||
"Invoking `logcat()` calls `run()` with the appropriate parameters." | ||
# Mock out the run command on an adb instance | ||
adb = ADB(mock_sdk, "exampleDevice") | ||
|
||
# Invoke logcat | ||
adb.logcat() | ||
|
||
# Validate call parameters. | ||
mock_sdk.command.subprocess.run.assert_called_once_with( | ||
[ | ||
os.fsdecode(mock_sdk.adb_path), | ||
"-s", | ||
"exampleDevice", | ||
"logcat", | ||
"-s", | ||
"MainActivity:*", | ||
"stdio:*", | ||
"Python:*", | ||
], | ||
env=mock_sdk.env, | ||
check=True, | ||
) | ||
|
||
|
||
def test_adb_failure(mock_sdk): | ||
"If adb logcat fails, the error is caught." | ||
# Mock out the run command on an adb instance | ||
adb = ADB(mock_sdk, "exampleDevice") | ||
mock_sdk.command.subprocess.run = MagicMock(side_effect=subprocess.CalledProcessError( | ||
returncode=1, cmd='adb logcat' | ||
)) | ||
|
||
with pytest.raises(BriefcaseCommandError): | ||
adb.logcat() |
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
Oops, something went wrong.