forked from pool/python-python-for-android
Python android tools OBS-URL: https://build.opensuse.org/request/show/848670 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-python-for-android?expand=0&rev=1
111 lines
4.1 KiB
Diff
111 lines
4.1 KiB
Diff
commit 02df176254d687e073243fbb8d9264412b423abd
|
|
Author: John Vandenberg <jayvdb@gmail.com>
|
|
Date: Sun Nov 15 14:49:34 2020 +0700
|
|
|
|
Support tests on varied arch
|
|
|
|
diff --git a/tests/recipes/test_icu.py b/tests/recipes/test_icu.py
|
|
index 00cfbdbb..39c29047 100644
|
|
--- a/tests/recipes/test_icu.py
|
|
+++ b/tests/recipes/test_icu.py
|
|
@@ -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):
|
|
@@ -48,7 +48,7 @@ class TestIcuRecipe(RecipeCtx, unittest.TestCase):
|
|
):
|
|
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")
|
|
diff --git a/tests/test_archs.py b/tests/test_archs.py
|
|
index 61887e0e..62ea711d 100644
|
|
--- a/tests/test_archs.py
|
|
+++ b/tests/test_archs.py
|
|
@@ -8,7 +8,7 @@ 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,
|
|
@@ -72,7 +72,7 @@ class ArchSetUpBaseClass(object):
|
|
# 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"
|
|
)
|
|
|
|
|
|
diff --git a/tests/test_bootstrap.py b/tests/test_bootstrap.py
|
|
index f1cff914..8fcedb53 100644
|
|
--- a/tests/test_bootstrap.py
|
|
+++ b/tests/test_bootstrap.py
|
|
@@ -4,7 +4,6 @@ import sh
|
|
import unittest
|
|
|
|
from unittest import mock
|
|
-from platform import system
|
|
|
|
from pythonforandroid.bootstrap import (
|
|
_cmp_bootstraps_by_priority, Bootstrap, expand_dependencies,
|
|
@@ -13,7 +12,7 @@ from pythonforandroid.distribution import Distribution, generate_dist_folder_nam
|
|
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
|
|
|
|
@@ -531,7 +530,7 @@ class GenericBootstrapTest(BaseClassSetupBootstrap):
|
|
):
|
|
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")
|
|
diff --git a/tests/test_recipe.py b/tests/test_recipe.py
|
|
index ef5e1ad4..ffe254cb 100644
|
|
--- a/tests/test_recipe.py
|
|
+++ b/tests/test_recipe.py
|
|
@@ -5,12 +5,12 @@ import unittest
|
|
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
|
|
|
|
|
|
@@ -284,7 +284,7 @@ class TesSTLRecipe(BaseClassSetupBootstrap, unittest.TestCase):
|
|
"""
|
|
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"]
|