From 835bbdb5bb47b07448bb0975d6b2b2a63cb4bdc4 Mon Sep 17 00:00:00 2001 From: Julian-o Date: Sun, 27 Aug 2023 16:31:22 +1000 Subject: [PATCH] PEP8, typo, MOCK->mock, unused code --- buildozer/__init__.py | 3 +-- buildozer/targets/ios.py | 2 +- tests/targets/test_android.py | 11 +++++------ tests/targets/test_ios.py | 2 +- tests/targets/utils.py | 4 ---- 5 files changed, 8 insertions(+), 14 deletions(-) diff --git a/buildozer/__init__.py b/buildozer/__init__.py index 8b4a31fc7..37ac57f43 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -20,7 +20,6 @@ import warnings import buildozer.buildops as buildops -from buildozer.exceptions import BuildozerCommandException from buildozer.jsonstore import JsonStore from buildozer.logger import Logger from buildozer.specparser import SpecParser @@ -283,7 +282,7 @@ def _ensure_virtualenv(self): env=self.environ) # read virtualenv output and parse it - assert(sys.platform != "win32", "Can't call bash on Windows") + assert sys.platform != "win32", "Can't call bash on Windows" output = buildops.cmd( ["bash", "-c", "source venv/bin/activate && env"], get_stdout=True, diff --git a/buildozer/targets/ios.py b/buildozer/targets/ios.py index 2bbbe3105..264e800ef 100644 --- a/buildozer/targets/ios.py +++ b/buildozer/targets/ios.py @@ -437,7 +437,7 @@ def _unlock_keychain(self): error = buildops.cmd( ["security", "unlock-keychain", "-u"], break_on_error=False, - quiet=True, # Log doesn't need secure info + quiet=True, # Log doesn't need secure info env=self.buildozer.environ).return_code if not error: return diff --git a/tests/targets/test_android.py b/tests/targets/test_android.py index dd32fac10..f1cdf293d 100644 --- a/tests/targets/test_android.py +++ b/tests/targets/test_android.py @@ -9,7 +9,6 @@ from buildozer.targets.android import TargetAndroid from tests.targets.utils import ( init_buildozer, - patch_buildozer, patch_buildops_checkbin, patch_buildops_cmd, patch_buildops_file_exists, @@ -25,7 +24,7 @@ def patch_buildops_download(): def patch_buildops_file_extract(): - return mock.path("buildozer.buildops.file_extract") + return mock.patch("buildozer.buildops.file_extract") def patch_os_isfile(): @@ -154,7 +153,7 @@ def test_check_requirements(self): assert not hasattr(target_android, "adb_executable") assert not hasattr(target_android, "adb_args") assert not hasattr(target_android, "javac_cmd") - assert "PATH" not in buildozer.environ + del buildozer.environ["PATH"] with patch_buildops_checkbin() as m_checkbin: target_android.check_requirements() assert m_checkbin.call_args_list == [ @@ -255,7 +254,7 @@ def test_execute_build_package__debug__apk(self): "arm64-v8a", "--arch", "armeabi-v7a" - ]) + ], env=mock.ANY) ] def test_execute_build_package__release__apk(self): @@ -278,7 +277,7 @@ def test_execute_build_package__release__apk(self): "arm64-v8a", "--arch", "armeabi-v7a" - ]) + ], env=mock.ANY) ] def test_execute_build_package__release__aab(self): @@ -302,7 +301,7 @@ def test_execute_build_package__release__aab(self): "arm64-v8a", "--arch", "armeabi-v7a", - ]) + ], env=mock.ANY) ] def test_numeric_version(self): diff --git a/tests/targets/test_ios.py b/tests/targets/test_ios.py index ce95ac58a..8d841cb5b 100644 --- a/tests/targets/test_ios.py +++ b/tests/targets/test_ios.py @@ -237,7 +237,7 @@ def test_build_package_no_signature(self): "clean", "build"], cwd="/ios/dir/myapp-ios", - env=MOCK.ANY, + env=mock.ANY, ), mock.call([ "xcodebuild", diff --git a/tests/targets/utils.py b/tests/targets/utils.py index f328c36bc..dd41c4fc8 100644 --- a/tests/targets/utils.py +++ b/tests/targets/utils.py @@ -6,10 +6,6 @@ from buildozer import Buildozer -def patch_buildozer(method): - return mock.patch("buildozer.Buildozer.{method}".format(method=method)) - - def patch_buildops_cmd(): return mock.patch("buildozer.buildops.cmd")