Skip to content

Commit d2220d5

Browse files
committed
Fixed test_distribution.py
1 parent 06be964 commit d2220d5

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

tests/test_distribution.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from pythonforandroid.build import Context
1111

1212
dist_info_data = {
13-
"dist_name": None,
13+
"dist_name": "sdl2_dist",
1414
"bootstrap": "sdl2",
1515
"archs": ["armeabi", "armeabi-v7a", "x86", "x86_64", "arm64-v8a"],
1616
"ndk_api": 21,
@@ -27,6 +27,8 @@ class TestDistribution(unittest.TestCase):
2727
:mod:`~pythonforandroid.distribution`.
2828
"""
2929

30+
TEST_ARCH = 'armeabi-v7a'
31+
3032
def setUp(self):
3133
"""Configure a :class:`~pythonforandroid.build.Context` so we can
3234
perform our unittests"""
@@ -51,8 +53,10 @@ def setUp_distribution_with_bootstrap(self, bs, **kwargs):
5153
self.ctx,
5254
name=kwargs.pop("name", "test_prj"),
5355
recipes=kwargs.pop("recipes", ["python3", "kivy"]),
56+
arch_name=self.TEST_ARCH,
5457
**kwargs
5558
)
59+
print('distribution when made is', self.ctx.bootstrap.distribution)
5660

5761
def tearDown(self):
5862
"""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):
108112
returns the proper result which should `unnamed_dist_1`."""
109113
mock_exists.return_value = False
110114
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)
112116
self.assertEqual(dist.name, "unnamed_dist_1")
113117

114118
@mock.patch("pythonforandroid.util.chdir")
@@ -154,10 +158,12 @@ def test_get_distributions(
154158
]
155159

156160
dists = self.ctx.bootstrap.distribution.get_distributions(self.ctx)
161+
print('dists are', dists)
157162
self.assertIsInstance(dists, list)
158163
self.assertEqual(len(dists), 1)
159164
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")
161167
self.assertEqual(dists[0].ndk_api, 21)
162168
self.assertEqual(
163169
dists[0].recipes,
@@ -206,7 +212,10 @@ def test_get_distributions_error_ndk_api_mismatch(
206212
distribution with the same `name` but different `ndk_api`.
207213
"""
208214
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,
210219
)
211220
mock_get_dists.return_value = [expected_dist]
212221
mock_glob.return_value = ["sdl2-python3"]
@@ -254,7 +263,10 @@ def test_get_distributions_possible_dists(self, mock_get_dists):
254263
`:class:`~pythonforandroid.distribution.Distribution`.
255264
"""
256265
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,
258270
)
259271
mock_get_dists.return_value = [expected_dist]
260272
self.setUp_distribution_with_bootstrap(

0 commit comments

Comments
 (0)