diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index b03f51a..6367649 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -374,13 +374,10 @@ class TargetAndroid(Target): self.buildozer.info('Android SDK is missing, downloading') if platform in ('win32', 'cygwin'): archive = 'sdk-tools-windows-{}.zip'.format(DEFAULT_SDK_TAG) - unpacked = 'android-sdk-windows' elif platform in ('darwin', ): archive = 'sdk-tools-darwin-{}.zip'.format(DEFAULT_SDK_TAG) - unpacked = 'android-sdk-macosx' elif platform.startswith('linux'): archive = 'sdk-tools-linux-{}.zip'.format(DEFAULT_SDK_TAG) - unpacked = 'android-sdk-linux' else: raise SystemError('Unsupported platform: {0}'.format(platform)) @@ -784,7 +781,6 @@ class TargetAndroid(Target): if local_recipes: options.append('--local-recipes') options.append(local_recipes) - config = self.buildozer.config self._p4a( ("create --dist_name={} --bootstrap={} --requirements={} " "--arch {} {}").format( @@ -811,7 +807,6 @@ class TargetAndroid(Target): old_dist_dir = join(self._build_dir, 'dists', dist_name) if exists(old_dist_dir): return old_dist_dir - matching_dirs = glob.glob(join(self._build_dir, 'dist', '{}*'.format(dist_name))) # If no directory has been found yet, our dist probably # doesn't exist yet, so use the expected name diff --git a/buildozer/targets/osx.py b/buildozer/targets/osx.py index 45c1586..6b60e60 100644 --- a/buildozer/targets/osx.py +++ b/buildozer/targets/osx.py @@ -114,7 +114,6 @@ class TargetOSX(Target): bc = self.buildozer.config bcg = bc.get - bcgl = bc.getlist package_name = bcg('app', 'package.name') domain = bcg('app', 'package.domain') title = bcg('app', 'title') diff --git a/tests/targets/test_android.py b/tests/targets/test_android.py index 10c6768..4e8be37 100644 --- a/tests/targets/test_android.py +++ b/tests/targets/test_android.py @@ -88,7 +88,7 @@ class TestTargetAndroid: def test_init_positional_buildozer(self): """Positional `buildozer` argument is required.""" with pytest.raises(TypeError) as ex_info: - target_android = TargetAndroid() + TargetAndroid() assert ex_info.value.args == ( "__init__() missing 1 required positional argument: 'buildozer'", ) diff --git a/tests/test_buildozer.py b/tests/test_buildozer.py index eeff341..3137a22 100644 --- a/tests/test_buildozer.py +++ b/tests/test_buildozer.py @@ -48,8 +48,8 @@ class TestBuildozer(unittest.TestCase): """ with open(filepath) as f: file_content = f.read() + file_content = re.sub(pattern, replace, file_content) with open(filepath, 'w') as f: - file_content = re.sub(pattern, replace, file_content) f.write(file_content) @classmethod @@ -61,6 +61,7 @@ class TestBuildozer(unittest.TestCase): replace = 'log_level = {}'.format(log_level) cls.file_re_sub(specfilename, pattern, replace) buildozer = Buildozer(specfilename) + assert buildozer.log_level == log_level def test_buildozer_base(self): """ @@ -155,15 +156,17 @@ class TestBuildozer(unittest.TestCase): # Mock first run with mock.patch('buildozer.Buildozer.download') as download, \ - mock.patch('buildozer.Buildozer.file_extract') as extract_file, \ + mock.patch('buildozer.Buildozer.file_extract') as m_file_extract, \ mock.patch('os.makedirs'): ant_path = target._install_apache_ant() - assert ant_path == my_ant_path - + assert m_file_extract.call_args_list == [mock.call(mock.ANY, cwd='/my/ant/path')] + assert ant_path == my_ant_path + assert download.call_args_list == [ + mock.call("http://archive.apache.org/dist/ant/binaries/", mock.ANY, cwd=my_ant_path)] # Mock ant already installed with mock.patch.object(Buildozer, 'file_exists', return_value=True): ant_path = target._install_apache_ant() - assert ant_path == my_ant_path + assert ant_path == my_ant_path def test_cmd_unicode_decode(self): """ diff --git a/tox.ini b/tox.ini index e112d6e..a63f874 100644 --- a/tox.ini +++ b/tox.ini @@ -38,7 +38,6 @@ ignore = E731, # do not assign a lambda expression, use a def F401, # imported but unused F821, # undefined name - F841, # local variable is assigned to but never used W503, # line break before binary operator W504, # line break after binary operator W605 # invalid escape sequence