Accepting request 1199747 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/1199747
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-tblib?expand=0&rev=9
This commit is contained in:
Ana Guerrero 2024-09-10 19:12:42 +00:00 committed by Git OBS Bridge
commit 2eb4d7ec82
3 changed files with 50 additions and 0 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Sep 9 12:30:08 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Cherry-pick patch from Fedora to fix testsuite with Python 3.13
* test_pickle_exception-even-harder-location-stripping.patch
-------------------------------------------------------------------
Fri May 31 22:34:24 UTC 2024 - Matej Cepl <mcepl@cepl.eu>

View File

@ -37,6 +37,8 @@ Source: https://files.pythonhosted.org/packages/source/t/tblib/tblib-%{v
Patch0: vendore-reraise-from-six.patch
# PATCH-FIX-UPSTREAM https://github.com/ionelmc/python-tblib/issues/74 More aggressive location stripping. Ref #74.
Patch1: more-aggressive-location-stripping.patch
# PATCH-FIX-FEDORA https://src.fedoraproject.org/rpms/python-tblib/blob/rawhide/f/0001-test_pickle_exception-even-harder-location-stripping.patch
Patch2: test_pickle_exception-even-harder-location-stripping.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}

View File

@ -0,0 +1,42 @@
From 11329603da1f9600e29bbd8f2c2a704ae0062e49 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Tue, 18 Jun 2024 12:19:02 -0700
Subject: [PATCH] test_pickle_exception: even harder location stripping. Ref
#74.
With Python 3.13, we need to strip even harder, because we get
location lines with differing amounts of tildes and up carets in
them, e.g.:
~~^~~~~
and:
^^^^^^^
Let's ditch the regex and instead go line-by-line with a pretty
loose match for anything that looks like a location line.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
tests/test_pickle_exception.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tests/test_pickle_exception.py b/tests/test_pickle_exception.py
index 53a9dce..afe0d69 100644
--- a/tests/test_pickle_exception.py
+++ b/tests/test_pickle_exception.py
@@ -30,7 +30,9 @@ class CustomError(Exception):
def strip_locations(tb_text):
- return tb_text.replace(' ~~^~~\n', '').replace(' ^^^^^^^^^^^^^^^^^\n', '')
+ lines = tb_text.splitlines()
+ lines = [line for line in lines if '~~^~~' not in line and '^^^^' not in line]
+ return '\n'.join(lines)
@pytest.mark.parametrize('protocol', [None, *list(range(1, pickle.HIGHEST_PROTOCOL + 1))])
--
2.45.2