SHA256
1
0
forked from pool/python-tblib
python-tblib/more-aggressive-location-stripping.patch
Matej Cepl 0b675b4971 Accepting request 1177690 from home:mcalabkova:branches:devel:languages:python
- Update to 3.0.0
  * Removed support for legacy Pythons (2.7 up to 3.7) and added Pythons 
    3.11 and 3.12 in the test grid.
  * Added support for __context__, __suppress_context__ and __notes__.
  * Added the get_locals argument to tblib.pickling_support.install(), 
    tblib.Traceback and tblib.Frame.
- Add vendore-reraise-from-six.patch to get rid of six
- Add more-aggressive-location-stripping.patch to fix test failure
- Standardize multibuild

OBS-URL: https://build.opensuse.org/request/show/1177690
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-tblib?expand=0&rev=16
2024-05-31 22:31:30 +00:00

45 lines
1.8 KiB
Diff

From 66e14cdd101e4214cca6acca8f48b9abe4f75729 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= <contact@ionelmc.ro>
Date: Fri, 15 Dec 2023 16:52:07 +0200
Subject: [PATCH] More aggressive location stripping. Ref #74.
---
tests/test_pickle_exception.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
Index: tblib-3.0.0/tests/test_pickle_exception.py
===================================================================
--- tblib-3.0.0.orig/tests/test_pickle_exception.py
+++ tblib-3.0.0/tests/test_pickle_exception.py
@@ -29,6 +29,10 @@ class CustomError(Exception):
pass
+def strip_locations(tb_text):
+ return tb_text.replace(' ~~^~~\n', '').replace(' ^^^^^^^^^^^^^^^^^\n', '')
+
+
@pytest.mark.parametrize('protocol', [None, *list(range(1, pickle.HIGHEST_PROTOCOL + 1))])
@pytest.mark.parametrize('how', ['global', 'instance', 'class'])
def test_install(clear_dispatch_table, how, protocol):
@@ -58,8 +62,8 @@ def test_install(clear_dispatch_table, h
else:
raise AssertionError
- expected_format_exception = ''.join(format_exception(type(exc), exc, exc.__traceback__))
- print(expected_format_exception)
+ expected_format_exception = strip_locations(''.join(format_exception(type(exc), exc, exc.__traceback__)))
+
# Populate Exception.__dict__, which is used in some cases
exc.x = 1
exc.__cause__.x = 2
@@ -88,7 +92,7 @@ def test_install(clear_dispatch_table, h
if has_python311:
assert exc.__notes__ == ['note 1', 'note 2']
- assert expected_format_exception == ''.join(format_exception(type(exc), exc, exc.__traceback__))
+ assert expected_format_exception == strip_locations(''.join(format_exception(type(exc), exc, exc.__traceback__)))
@tblib.pickling_support.install