-
Notifications
You must be signed in to change notification settings - Fork 503
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exits with error code on build exception, fixes #674
- Loading branch information
1 parent
4183428
commit 586152c
Showing
3 changed files
with
28 additions
and
1 deletion.
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
Empty file.
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,26 @@ | ||
import sys | ||
import mock | ||
import unittest | ||
from buildozer import BuildozerCommandException | ||
from buildozer.scripts import client | ||
|
||
|
||
class TestClient(unittest.TestCase): | ||
|
||
def test_run_command_called(self): | ||
""" | ||
Checks Buildozer.run_command() is being called with arguments from command line. | ||
""" | ||
with mock.patch('buildozer.Buildozer.run_command') as m_run_command: | ||
client.main() | ||
assert m_run_command.call_args_list == [mock.call(sys.argv[1:])] | ||
|
||
def test_exit_code(self): | ||
""" | ||
Makes sure the CLI exits with error code on BuildozerCommandException, refs #674. | ||
""" | ||
with mock.patch('buildozer.Buildozer.run_command') as m_run_command: | ||
m_run_command.side_effect = BuildozerCommandException() | ||
with self.assertRaises(SystemExit) as context: | ||
client.main() | ||
assert context.exception.code == 1 |