From f74e216514513fe1318459d048cf23f0090fc574 Mon Sep 17 00:00:00 2001 From: Julian-o Date: Sun, 27 Aug 2023 16:19:57 +1000 Subject: [PATCH] Even more mocks missed and Shell=True bites back --- buildozer/targets/ios.py | 4 ++-- tests/targets/test_android.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/buildozer/targets/ios.py b/buildozer/targets/ios.py index adc1ed2f3..2bbbe3105 100644 --- a/buildozer/targets/ios.py +++ b/buildozer/targets/ios.py @@ -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( diff --git a/tests/targets/test_android.py b/tests/targets/test_android.py index 0b020edb2..dd32fac10 100644 --- a/tests/targets/test_android.py +++ b/tests/targets/test_android.py @@ -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(): @@ -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