Skip to content

Commit

Permalink
🔨 Support running tests on any arch (kivy#2355)
Browse files Browse the repository at this point in the history
  • Loading branch information
jayvdb authored and vesellov committed Feb 10, 2021
1 parent 68cd259 commit 27cc754
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tests/recipes/test_icu.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import os
import unittest
from unittest import mock
from platform import system

from tests.recipes.recipe_ctx import RecipeCtx
from pythonforandroid.recipes.icu import ICURecipe
from pythonforandroid.util import build_platform


class TestIcuRecipe(RecipeCtx, unittest.TestCase):
Expand Down Expand Up @@ -48,7 +48,7 @@ def test_build_arch(
):
mock_find_executable.return_value = os.path.join(
self.ctx._ndk_dir,
f"toolchains/llvm/prebuilt/{system().lower()}-x86_64/bin/clang",
f"toolchains/llvm/prebuilt/{build_platform}/bin/clang",
)
mock_archs_glob.return_value = [
os.path.join(self.ctx._ndk_dir, "toolchains", "llvm")
Expand Down
5 changes: 2 additions & 3 deletions tests/test_archs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
import unittest
from os import environ
from unittest import mock
from platform import system

from pythonforandroid.bootstrap import Bootstrap
from pythonforandroid.distribution import Distribution
from pythonforandroid.recipe import Recipe
from pythonforandroid.build import Context
from pythonforandroid.util import BuildInterruptingException
from pythonforandroid.util import BuildInterruptingException, build_platform
from pythonforandroid.archs import (
Arch,
ArchARM,
Expand Down Expand Up @@ -72,7 +71,7 @@ def setUp(self):
# should be the same for all the tests (no more gcc compiler)
self.expected_compiler = (
f"/opt/android/android-ndk/toolchains/"
f"llvm/prebuilt/{system().lower()}-x86_64/bin/clang"
f"llvm/prebuilt/{build_platform}/bin/clang"
)


Expand Down
5 changes: 2 additions & 3 deletions tests/test_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import unittest

from unittest import mock
from platform import system

from pythonforandroid.bootstrap import (
_cmp_bootstraps_by_priority, Bootstrap, expand_dependencies,
Expand All @@ -13,7 +12,7 @@
from pythonforandroid.recipe import Recipe
from pythonforandroid.archs import ArchARMv7_a
from pythonforandroid.build import Context
from pythonforandroid.util import BuildInterruptingException
from pythonforandroid.util import BuildInterruptingException, build_platform

from test_graph import get_fake_recipe

Expand Down Expand Up @@ -531,7 +530,7 @@ def test_bootstrap_strip(
):
mock_find_executable.return_value = os.path.join(
self.ctx._ndk_dir,
f"toolchains/llvm/prebuilt/{system().lower()}-x86_64/bin/clang",
f"toolchains/llvm/prebuilt/{build_platform}/bin/clang",
)
mock_glob.return_value = [
os.path.join(self.ctx._ndk_dir, "toolchains", "llvm")
Expand Down
4 changes: 2 additions & 2 deletions tests/test_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import warnings
from unittest import mock
from backports import tempfile
from platform import system

from pythonforandroid.build import Context
from pythonforandroid.recipe import Recipe, import_recipe
from pythonforandroid.archs import ArchAarch_64
from pythonforandroid.bootstrap import Bootstrap
from pythonforandroid.util import build_platform
from test_bootstrap import BaseClassSetupBootstrap


Expand Down Expand Up @@ -284,7 +284,7 @@ def test_get_recipe_env_with(
"""
expected_compiler = (
f"/opt/android/android-ndk/toolchains/"
f"llvm/prebuilt/{system().lower()}-x86_64/bin/clang"
f"llvm/prebuilt/{build_platform}/bin/clang"
)
mock_find_executable.return_value = expected_compiler
mock_glob.return_value = ["llvm"]
Expand Down

0 comments on commit 27cc754

Please sign in to comment.