Skip to content

Commit 751db4b

Browse files
committed
✅ Update tests to work without python2
1 parent 3fa2280 commit 751db4b

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

tests/test_bootstrap.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def test_attributes(self):
7676
bs = Bootstrap().get_bootstrap("sdl2", self.ctx)
7777
self.assertEqual(bs.name, "sdl2")
7878
self.assertEqual(bs.jni_dir, "sdl2/jni")
79-
self.assertEqual(bs.get_build_dir_name(), "sdl2-python3")
79+
self.assertEqual(bs.get_build_dir_name(), "sdl2")
8080

8181
# bs.dist_dir should raise an error if there is no distribution to query
8282
bs.distribution = None
@@ -100,7 +100,7 @@ def test_build_dist_dirs(self):
100100
bs = Bootstrap.get_bootstrap("sdl2", self.ctx)
101101

102102
self.assertTrue(
103-
bs.get_build_dir().endswith("build/bootstrap_builds/sdl2-python3")
103+
bs.get_build_dir().endswith("build/bootstrap_builds/sdl2")
104104
)
105105
self.assertTrue(bs.get_dist_dir("test_prj").endswith("dists/test_prj"))
106106
self.assertTrue(
@@ -181,8 +181,8 @@ def test_expand_dependencies_with_pure_python_package(self):
181181
expanded_result = expand_dependencies(
182182
["python3", "kivy", "peewee"], self.ctx
183183
)
184-
# we expect to have two results (one for python2 and one for python3)
185-
self.assertEqual(len(expanded_result), 2)
184+
# we expect to one results for python3
185+
self.assertEqual(len(expanded_result), 1)
186186
self.assertIsInstance(expanded_result, list)
187187
for i in expanded_result:
188188
self.assertIsInstance(i, list)
@@ -244,11 +244,6 @@ def _add_sdl2_conflicting_recipe(name, ctx):
244244
)
245245
self.assertEqual(bs.name, "service_only")
246246

247-
# Test wrong recipes
248-
wrong_recipes = {"python2", "python3", "pyjnius"}
249-
bs = Bootstrap.get_bootstrap_from_recipes(wrong_recipes, self.ctx)
250-
self.assertIsNone(bs)
251-
252247
@mock.patch("pythonforandroid.bootstrap.ensure_dir")
253248
def test_prepare_dist_dir(self, mock_ensure_dir):
254249
"""A test which will initialize a bootstrap and will check if the

tests/test_graph.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
ctx = Context()
1515

16-
name_sets = [['python2'],
16+
name_sets = [['python3'],
1717
['kivy']]
1818
bootstraps = [None,
1919
Bootstrap.get_bootstrap('sdl2', ctx)]
@@ -26,7 +26,7 @@
2626
]
2727
)
2828
invalid_combinations = [
29-
[['python2', 'python3'], None],
29+
[['pil', 'pillow'], None],
3030
[['pysdl2', 'genericndkbuild'], None],
3131
]
3232
invalid_combinations_simple = list(invalid_combinations)
@@ -211,7 +211,7 @@ def test_multichoice_obvious_conflict_checker(monkeypatch):
211211
def test_bootstrap_dependency_addition():
212212
build_order, python_modules, bs = get_recipe_order_and_bootstrap(
213213
ctx, ['kivy'], None)
214-
assert (('hostpython2' in build_order) or ('hostpython3' in build_order))
214+
assert ('hostpython3' in build_order)
215215

216216

217217
def test_graph_deplist_transformation():
@@ -227,8 +227,8 @@ def test_graph_deplist_transformation():
227227

228228
def test_bootstrap_dependency_addition2():
229229
build_order, python_modules, bs = get_recipe_order_and_bootstrap(
230-
ctx, ['kivy', 'python2'], None)
231-
assert 'hostpython2' in build_order
230+
ctx, ['kivy', 'python3'], None)
231+
assert 'hostpython3' in build_order
232232

233233

234234
if __name__ == "__main__":

0 commit comments

Comments
 (0)