From d2c494849e7fffa5c3672ad1d364db5c86b3b585f641c4f460df79a9ff8063e9 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Sat, 26 Nov 2022 22:25:49 +0000 Subject: [PATCH] Accepting request 1038348 from home:munix9:branches:devel:languages:python - Add fix-version_test.patch (gh#py-sdl/py-sdl2#248): Don't assert that SDL_GetRevision() starts with http - Skip rpmlint error python-tests-in-package I don't know exactly if the sdl2/test directories could be completely deleted in %install. I first chose the solution with rpmlintrc to filter the message "E: python-tests-in-package", similar to other python packages. OBS-URL: https://build.opensuse.org/request/show/1038348 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-PySDL2?expand=0&rev=25 --- fix-version_test.patch | 37 +++++++++++++++++++++++++++++++++++++ python-PySDL2.changes | 7 +++++++ python-PySDL2.rpmlintrc | 1 + python-PySDL2.spec | 3 +++ 4 files changed, 48 insertions(+) create mode 100644 fix-version_test.patch create mode 100644 python-PySDL2.rpmlintrc diff --git a/fix-version_test.patch b/fix-version_test.patch new file mode 100644 index 0000000..4c458fa --- /dev/null +++ b/fix-version_test.patch @@ -0,0 +1,37 @@ +From ffa8853517cc72afefc8205db675fdf44d519159 Mon Sep 17 00:00:00 2001 +From: Simon McVittie +Date: Wed, 2 Nov 2022 23:21:54 +0000 +Subject: [PATCH] version_test: Don't assert that SDL_GetRevision() starts with + http (#249) + +The default format is going to change in 2.25.x, and in git main it +currently starts with "SDL-". + +SDL specifically documents the result of this function as "not intended +to be reliable in any way", so it seems wrong to have pysdl2's tests fail +whenever the format changes. To address that, turn unexpected formats +into an xfail, so that they're flagged as something to investigate but +do not make the unit tests fail when used as a QA gate. + +Closes: https://github.com/py-sdl/py-sdl2/issues/248 +Signed-off-by: Simon McVittie + +Signed-off-by: Simon McVittie +--- + sdl2/test/version_test.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/sdl2/test/version_test.py b/sdl2/test/version_test.py +index 8a327e1..4c4f54c 100644 +--- a/sdl2/test/version_test.py ++++ b/sdl2/test/version_test.py +@@ -57,7 +57,8 @@ def test_SDL_GetRevision(): + # If revision not empty string (e.g. Conda), test the prefix + if len(rev): + if dll.version_tuple >= (2, 0, 16): +- assert rev[0:4] == b"http" ++ if rev[0:4] not in (b"http", b"SDL-"): ++ pytest.xfail("no API guarantee about the format of this string") + else: + assert rev[0:3] == b"hg-" + diff --git a/python-PySDL2.changes b/python-PySDL2.changes index 0948488..9b9e92f 100644 --- a/python-PySDL2.changes +++ b/python-PySDL2.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Sat Nov 26 14:51:13 UTC 2022 - munix9@googlemail.com + +- Add fix-version_test.patch (gh#py-sdl/py-sdl2#248): + Don't assert that SDL_GetRevision() starts with http +- Skip rpmlint error python-tests-in-package + ------------------------------------------------------------------- Wed Nov 2 12:09:29 UTC 2022 - Daniel Garcia diff --git a/python-PySDL2.rpmlintrc b/python-PySDL2.rpmlintrc new file mode 100644 index 0000000..7957f5d --- /dev/null +++ b/python-PySDL2.rpmlintrc @@ -0,0 +1 @@ +addFilter("E: python-tests-in-package.*/usr/lib/.*/site-packages/sdl2/test") diff --git a/python-PySDL2.spec b/python-PySDL2.spec index aa88e73..31f016a 100644 --- a/python-PySDL2.spec +++ b/python-PySDL2.spec @@ -24,8 +24,11 @@ Summary: Python ctypes wrapper around SDL2 License: SUSE-Public-Domain URL: https://github.com/py-sdl/py-sdl2 Source: https://files.pythonhosted.org/packages/source/P/PySDL2/PySDL2-%{version}.tar.gz +Source99: python-PySDL2.rpmlintrc # PATCH-FIX-OPENSUSE fix-tests.patch to make test work in chroot env without access to /dev/input Patch0: fix-tests.patch +# PATCH-FIX-UPSTREAM fix-version_test.patch gh#py-sdl/py-sdl2#248 +Patch1: fix-version_test.patch BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module wheel}