MCPcopy Create free account
hub / github.com/kivy/python-for-android / test_create

Method test_create

tests/test_toolchain.py:52–101  ·  view source on GitHub ↗

Basic `create` distribution test.

(self)

Source from the content-addressed store, hash-verified

50 assert m_print_help.call_args_list == [mock.call()]
51
52 def test_create(self):
53 """
54 Basic `create` distribution test.
55 """
56 argv = [
57 'toolchain.py',
58 'create',
59 '--sdk-dir=/tmp/android-sdk',
60 '--ndk-dir=/tmp/android-ndk',
61 '--bootstrap=service_only',
62 '--requirements=python3',
63 '--dist-name=test_toolchain',
64 '--activity-class-name=abc.myapp.android.CustomPythonActivity',
65 '--service-class-name=xyz.myapp.android.CustomPythonService',
66 '--arch=arm64-v8a',
67 '--arch=armeabi-v7a'
68 ]
69 with patch_sys_argv(argv), mock.patch(
70 'pythonforandroid.build.get_available_apis'
71 ) as m_get_available_apis, mock.patch(
72 'pythonforandroid.toolchain.build_recipes'
73 ) as m_build_recipes, mock.patch(
74 'pythonforandroid.bootstraps.service_only.'
75 'ServiceOnlyBootstrap.assemble_distribution'
76 ) as m_run_distribute:
77 m_get_available_apis.return_value = [33]
78 tchain = ToolchainCL()
79 assert tchain.ctx.activity_class_name == 'abc.myapp.android.CustomPythonActivity'
80 assert tchain.ctx.service_class_name == 'xyz.myapp.android.CustomPythonService'
81 assert m_get_available_apis.call_args_list in [
82 [mock.call('/tmp/android-sdk')], # linux case
83 [mock.call('/private/tmp/android-sdk')] # macos case
84 ]
85 build_order = [
86 'hostpython3', 'libffi', 'openssl', 'sqlite3', 'python3',
87 'genericndkbuild', 'pyjnius', 'android',
88 ]
89 python_modules = ['six']
90 context = mock.ANY
91 project_dir = None
92 assert m_build_recipes.call_args_list == [
93 mock.call(
94 build_order,
95 python_modules,
96 context,
97 project_dir,
98 ignore_project_setup_py=False
99 )
100 ]
101 assert m_run_distribute.call_args_list == [mock.call()]
102
103 @mock.patch(
104 'pythonforandroid.build.environ',

Callers

nothing calls this directly

Calls 2

ToolchainCLClass · 0.90
patch_sys_argvFunction · 0.85

Tested by

no test coverage detected