Skip to content

Commit

Permalink
Even more mocks missed and Shell=True bites back
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian-O committed Aug 27, 2023
1 parent 52ef3f6 commit f74e216
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions buildozer/targets/ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def check_requirements(self):
buildops.checkbin('libtool', 'libtool')

self.logger.debug('Check availability of a iPhone SDK')
sdk = buildops.cmd('xcodebuild -showsdks | fgrep "iphoneos" |'
'tail -n 1 | awk \'{print $2}\'',
sdk = buildops.cmd(['xcodebuild -showsdks | fgrep "iphoneos" |'
'tail -n 1 | awk \'{print $2}\''],
get_stdout=True, env=self.buildozer.environ).stdout
if not sdk:
raise Exception(
Expand Down
8 changes: 4 additions & 4 deletions tests/targets/test_android.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
)


def patch_buildozer_cmd_expect():
return patch_buildozer("cmd_expect")
def patch_buildops_cmd_expect():
return mock.patch("buildozer.buildops.cmd_expect")


def patch_buildops_download():
Expand Down Expand Up @@ -131,14 +131,14 @@ def test_sdkmanager(self):
"""Tests the _sdkmanager() method."""
target_android = init_target(self.temp_dir)
kwargs = {}
with patch_buildops_cmd() as m_cmd, patch_buildozer_cmd_expect() as m_cmd_expect, patch_os_isfile() as m_isfile:
with patch_buildops_cmd() as m_cmd, patch_buildops_cmd_expect() as m_cmd_expect, patch_os_isfile() as m_isfile:
m_isfile.return_value = True
assert m_cmd.return_value == target_android._sdkmanager(**kwargs)
assert m_cmd.call_count == 1
assert m_cmd_expect.call_count == 0
assert m_isfile.call_count == 1
kwargs = {"return_child": True}
with patch_buildops_cmd() as m_cmd, patch_buildozer_cmd_expect() as m_cmd_expect, patch_os_isfile() as m_isfile:
with patch_buildops_cmd() as m_cmd, patch_buildops_cmd_expect() as m_cmd_expect, patch_os_isfile() as m_isfile:
m_isfile.return_value = True
assert m_cmd_expect.return_value == target_android._sdkmanager(
**kwargs
Expand Down

0 comments on commit f74e216

Please sign in to comment.