From 26b99bd32b55475dc54d3ea177c9c7d573b21ac0 Mon Sep 17 00:00:00 2001 From: butomo1989 Date: Fri, 17 Mar 2017 12:41:28 +0100 Subject: [PATCH] Fixed installation bug --- src/android.py | 6 +++--- src/tests/android/test_item_position.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/android.py b/src/android.py index e5ad488..d0191d0 100644 --- a/src/android.py +++ b/src/android.py @@ -37,8 +37,7 @@ def get_item_position(keyword, items): pos = 0 for p, v in enumerate(items): if keyword in v: - pos = p - break # Get the first item that match with keyword + pos = p # Get the last item that match with keyword return pos @@ -58,8 +57,9 @@ def get_api_level(android_version): if packages: item_pos = get_item_position(android_version, packages) - logger.info('package in position: {pos}'.format(pos=item_pos)) + logger.info('Package in position: {pos}'.format(pos=item_pos)) item = packages[item_pos] + logger.info('Item: {item}'.format(item=item)) item_info = item.split('-') api_version = re.search('%s(.*)%s' % ('API', ','), item_info[1]).group(1).strip() diff --git a/src/tests/android/test_item_position.py b/src/tests/android/test_item_position.py index 0a1585e..9dac508 100644 --- a/src/tests/android/test_item_position.py +++ b/src/tests/android/test_item_position.py @@ -13,7 +13,7 @@ class TestItemPosition(TestCase): def test_valid_params(self): keyword = '4.2' output = android.get_item_position(keyword, self.items) - self.assertEqual(1, output) + self.assertEqual(4, output) def test_invalid_keyword(self): keyword = 'fake'