14
0

Accepting request 1204662 from devel:languages:python

- Add patch fix-mock-assertion.patch:
  * Correct mock has_calls call.
- Skip recalcitrant test.

OBS-URL: https://build.opensuse.org/request/show/1204662
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-python-for-android?expand=0&rev=9
This commit is contained in:
2024-09-30 13:41:15 +00:00
committed by Git OBS Bridge
3 changed files with 51 additions and 5 deletions

35
fix-mock-assertion.patch Normal file
View File

@@ -0,0 +1,35 @@
From 5d5ca2b57aa49c508950c927eb42d2ffe14c3cf6 Mon Sep 17 00:00:00 2001
From: Steve Kowalik <steven@wedontsleep.org>
Date: Tue, 9 Apr 2024 15:36:24 +1000
Subject: [PATCH] Fix mock assertion in ICU recipe
Python 3.12 now does not blindly any methods on mocked objects, which
masks issues. Correct the assertion of has_calls to assert_has_calls in
the ICU recipe.
Fixes #3002
---
tests/recipes/test_icu.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tests/recipes/test_icu.py b/tests/recipes/test_icu.py
index 239b99e4c1..dacf65a0b4 100644
--- a/tests/recipes/test_icu.py
+++ b/tests/recipes/test_icu.py
@@ -52,13 +52,14 @@ def test_build_arch(
# We expect some calls to `sh.Command`
build_root = self.recipe.get_build_dir(self.arch.arch)
- mock_sh_command.has_calls(
+ mock_sh_command.assert_has_calls(
[
mock.call(
os.path.join(build_root, "source", "runConfigureICU")
),
mock.call(os.path.join(build_root, "source", "configure")),
- ]
+ ],
+ any_order=True
)
mock_ensure_dir.assert_called()
mock_chdir.assert_called()

View File

@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Sep 30 06:32:03 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch fix-mock-assertion.patch:
* Correct mock has_calls call.
- Skip recalcitrant test.
-------------------------------------------------------------------
Mon Apr 8 05:32:06 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>

View File

@@ -27,6 +27,8 @@ Source: https://github.com/kivy/python-for-android/archive/refs/tags/v%{
Source1: python-python-for-android-rpmlintrc
# PATCH-FIX-OPENSUSE We don't need or want isolation when determining metadata
Patch0: no-isolation-for-metadata-build.patch
# PATCH-FIX-UPSTREAM gh#kivy/python-for-android#3003
Patch1: fix-mock-assertion.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@@ -34,12 +36,14 @@ Requires: python-Jinja2
Requires: python-appdirs
Requires: python-build
Requires: python-colorama >= 0.3.3
Requires: python-packaging
Requires: python-setuptools
Requires: python-sh >= 2
Requires: python-toml
Requires(post): update-alternatives
Requires(postun): update-alternatives
Recommends: cmake
Recommends: python-pip
Recommends: python-setuptools
Recommends: python-wheel
BuildArch: noarch
# SECTION test requirements
@@ -108,8 +112,8 @@ export PYTHONPATH=${PWD}:${PWD}/tests/
skip_tests="test_get_dep_names_of_package or test_get_package_dependencies or test_venv or test_get_package_as_folder or test_extract_metainfo_files_from_package"
# Unable to download NDK
skip_tests="$skip_tests or (TestToolchainCL and test_create) or test_create_python_bundle"
# Broken with 3.12 - https://github.com/kivy/python-for-android/issues/3002
skip_tests="$skip_tests or (TestIcuRecipe and test_build_arch)"
# build_dir is somehow None
skip_tests="$skip_tests or (TestSDL2MixerRecipe and test_get_include_dirs)"
%pytest -rs tests -k "not ($skip_tests)"
@@ -124,7 +128,7 @@ skip_tests="$skip_tests or (TestIcuRecipe and test_build_arch)"
%license LICENSE
%python_alternative %{_bindir}/python-for-android
%python_alternative %{_bindir}/p4a
%{python_sitelib}/*pythonforandroid*/
%{python_sitelib}/*python_for_android*/
%{python_sitelib}/pythonforandroid
%{python_sitelib}/python_for_android-%{version}.dist-info
%changelog