Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✅ Tests android.numeric_version config #1129

Merged
merged 1 commit into from
May 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 28 additions & 5 deletions tests/targets/test_android.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import re
import tempfile
from unittest import mock

Expand Down Expand Up @@ -93,11 +94,8 @@ def init_target(self, options=None):
spec = []
for line in default_spec:
if line.strip():
key = line.split()[0]

if key.startswith('#'):
key = key[1:]

match = re.search(r'[#\s]?([a-z_\.]+)', line)
key = match and match.group(1)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More accurate (handle spaces just after the # comment), yet more concise version.
Works on matching:

#config.option = foo

As well as:

# config.option = foo

Both would make key = "config.option"

if key in options:
line = '{} = {}\n'.format(key, options[key])

Expand Down Expand Up @@ -288,6 +286,31 @@ def test_build_package(self):
)
]

def test_numeric_version(self):
"""The `android.numeric_version` config should be passed to `build_package()`."""
self.init_target({
"android.numeric_version": "1234"
})
m_execute_build_package = self.call_build_package()
assert m_execute_build_package.call_args_list == [
mock.call(
[
("--name", "'My Application'"),
("--version", "0.1"),
("--package", "org.test.myapp"),
("--minsdk", "21"),
("--ndk-api", "21"),
("--private", "{buildozer_dir}/android/app".format(buildozer_dir=self.buildozer.buildozer_dir)),
("--android-entrypoint", "org.kivy.android.PythonActivity"),
("--android-apptheme", "@android:style/Theme.NoTitleBar"),
("--orientation", "portrait"),
("--window",),
("--numeric-version", "1234"),
("debug",),
]
)
]

def test_build_package_intent_filters(self):
"""
The build_package() method should honour the manifest.intent_filters
Expand Down