Skip to content

Commit 63db01c

Browse files
authored
🔨 Support running tests on any arch (kivy#2355)
1 parent 6e48aa9 commit 63db01c

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

tests/recipes/test_icu.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import os
22
import unittest
33
from unittest import mock
4-
from platform import system
54

65
from tests.recipes.recipe_ctx import RecipeCtx
76
from pythonforandroid.recipes.icu import ICURecipe
7+
from pythonforandroid.util import build_platform
88

99

1010
class TestIcuRecipe(RecipeCtx, unittest.TestCase):
@@ -48,7 +48,7 @@ def test_build_arch(
4848
):
4949
mock_find_executable.return_value = os.path.join(
5050
self.ctx._ndk_dir,
51-
f"toolchains/llvm/prebuilt/{system().lower()}-x86_64/bin/clang",
51+
f"toolchains/llvm/prebuilt/{build_platform}/bin/clang",
5252
)
5353
mock_archs_glob.return_value = [
5454
os.path.join(self.ctx._ndk_dir, "toolchains", "llvm")

tests/test_archs.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
import unittest
33
from os import environ
44
from unittest import mock
5-
from platform import system
65

76
from pythonforandroid.bootstrap import Bootstrap
87
from pythonforandroid.distribution import Distribution
98
from pythonforandroid.recipe import Recipe
109
from pythonforandroid.build import Context
11-
from pythonforandroid.util import BuildInterruptingException
10+
from pythonforandroid.util import BuildInterruptingException, build_platform
1211
from pythonforandroid.archs import (
1312
Arch,
1413
ArchARM,
@@ -72,7 +71,7 @@ def setUp(self):
7271
# should be the same for all the tests (no more gcc compiler)
7372
self.expected_compiler = (
7473
f"/opt/android/android-ndk/toolchains/"
75-
f"llvm/prebuilt/{system().lower()}-x86_64/bin/clang"
74+
f"llvm/prebuilt/{build_platform}/bin/clang"
7675
)
7776

7877

tests/test_bootstrap.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import unittest
55

66
from unittest import mock
7-
from platform import system
87

98
from pythonforandroid.bootstrap import (
109
_cmp_bootstraps_by_priority, Bootstrap, expand_dependencies,
@@ -13,7 +12,7 @@
1312
from pythonforandroid.recipe import Recipe
1413
from pythonforandroid.archs import ArchARMv7_a
1514
from pythonforandroid.build import Context
16-
from pythonforandroid.util import BuildInterruptingException
15+
from pythonforandroid.util import BuildInterruptingException, build_platform
1716

1817
from test_graph import get_fake_recipe
1918

@@ -531,7 +530,7 @@ def test_bootstrap_strip(
531530
):
532531
mock_find_executable.return_value = os.path.join(
533532
self.ctx._ndk_dir,
534-
f"toolchains/llvm/prebuilt/{system().lower()}-x86_64/bin/clang",
533+
f"toolchains/llvm/prebuilt/{build_platform}/bin/clang",
535534
)
536535
mock_glob.return_value = [
537536
os.path.join(self.ctx._ndk_dir, "toolchains", "llvm")

tests/test_recipe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
import warnings
66
from unittest import mock
77
from backports import tempfile
8-
from platform import system
98

109
from pythonforandroid.build import Context
1110
from pythonforandroid.recipe import Recipe, import_recipe
1211
from pythonforandroid.archs import ArchAarch_64
1312
from pythonforandroid.bootstrap import Bootstrap
13+
from pythonforandroid.util import build_platform
1414
from test_bootstrap import BaseClassSetupBootstrap
1515

1616

@@ -284,7 +284,7 @@ def test_get_recipe_env_with(
284284
"""
285285
expected_compiler = (
286286
f"/opt/android/android-ndk/toolchains/"
287-
f"llvm/prebuilt/{system().lower()}-x86_64/bin/clang"
287+
f"llvm/prebuilt/{build_platform}/bin/clang"
288288
)
289289
mock_find_executable.return_value = expected_compiler
290290
mock_glob.return_value = ["llvm"]

0 commit comments

Comments
 (0)