10
10
from pythonforandroid .build import Context
11
11
12
12
dist_info_data = {
13
- "dist_name" : None ,
13
+ "dist_name" : "sdl2_dist" ,
14
14
"bootstrap" : "sdl2" ,
15
15
"archs" : ["armeabi" , "armeabi-v7a" , "x86" , "x86_64" , "arm64-v8a" ],
16
16
"ndk_api" : 21 ,
@@ -27,6 +27,8 @@ class TestDistribution(unittest.TestCase):
27
27
:mod:`~pythonforandroid.distribution`.
28
28
"""
29
29
30
+ TEST_ARCH = 'armeabi-v7a'
31
+
30
32
def setUp (self ):
31
33
"""Configure a :class:`~pythonforandroid.build.Context` so we can
32
34
perform our unittests"""
@@ -51,8 +53,10 @@ def setUp_distribution_with_bootstrap(self, bs, **kwargs):
51
53
self .ctx ,
52
54
name = kwargs .pop ("name" , "test_prj" ),
53
55
recipes = kwargs .pop ("recipes" , ["python3" , "kivy" ]),
56
+ arch_name = self .TEST_ARCH ,
54
57
** kwargs
55
58
)
59
+ print ('distribution when made is' , self .ctx .bootstrap .distribution )
56
60
57
61
def tearDown (self ):
58
62
"""Here we make sure that we reset a possible bootstrap created in
@@ -108,7 +112,7 @@ def test_get_distribution_no_name(self, mock_exists):
108
112
returns the proper result which should `unnamed_dist_1`."""
109
113
mock_exists .return_value = False
110
114
self .ctx .bootstrap = Bootstrap ().get_bootstrap ("sdl2" , self .ctx )
111
- dist = Distribution .get_distribution (self .ctx )
115
+ dist = Distribution .get_distribution (self .ctx , arch_name = self . TEST_ARCH )
112
116
self .assertEqual (dist .name , "unnamed_dist_1" )
113
117
114
118
@mock .patch ("pythonforandroid.util.chdir" )
@@ -154,10 +158,12 @@ def test_get_distributions(
154
158
]
155
159
156
160
dists = self .ctx .bootstrap .distribution .get_distributions (self .ctx )
161
+ print ('dists are' , dists )
157
162
self .assertIsInstance (dists , list )
158
163
self .assertEqual (len (dists ), 1 )
159
164
self .assertIsInstance (dists [0 ], Distribution )
160
- self .assertEqual (dists [0 ].name , "sdl2-python3" )
165
+ self .assertEqual (dists [0 ].name , "sdl2_dist" )
166
+ self .assertEqual (dists [0 ].dist_dir , "sdl2-python3" )
161
167
self .assertEqual (dists [0 ].ndk_api , 21 )
162
168
self .assertEqual (
163
169
dists [0 ].recipes ,
@@ -206,7 +212,10 @@ def test_get_distributions_error_ndk_api_mismatch(
206
212
distribution with the same `name` but different `ndk_api`.
207
213
"""
208
214
expected_dist = Distribution .get_distribution (
209
- self .ctx , name = "test_prj" , recipes = ["python3" , "kivy" ]
215
+ self .ctx ,
216
+ name = "test_prj" ,
217
+ recipes = ["python3" , "kivy" ],
218
+ arch_name = self .TEST_ARCH ,
210
219
)
211
220
mock_get_dists .return_value = [expected_dist ]
212
221
mock_glob .return_value = ["sdl2-python3" ]
@@ -254,7 +263,10 @@ def test_get_distributions_possible_dists(self, mock_get_dists):
254
263
`:class:`~pythonforandroid.distribution.Distribution`.
255
264
"""
256
265
expected_dist = Distribution .get_distribution (
257
- self .ctx , name = "test_prj" , recipes = ["python3" , "kivy" ]
266
+ self .ctx ,
267
+ name = "test_prj" ,
268
+ recipes = ["python3" , "kivy" ],
269
+ arch_name = self .TEST_ARCH ,
258
270
)
259
271
mock_get_dists .return_value = [expected_dist ]
260
272
self .setUp_distribution_with_bootstrap (
0 commit comments