From 1a0d94e82319a45017c623b76d177d22b57f2e1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= Date: Mon, 24 Jan 2022 09:11:57 +0100 Subject: Adapt tests for Python 3.11 Fix broken tests, Python 3.11 brings in enhanced error locations in tracebacks. --- c/test_c.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'c') diff --git a/c/test_c.py b/c/test_c.py index 654584d..e23c7fe 100644 --- a/c/test_c.py +++ b/c/test_c.py @@ -1384,8 +1384,10 @@ Exception ignored from cffi callback : Traceback (most recent call last): File "$", line $, in Zcb1 $ + $ File "$", line $, in check_value $ + $ ValueError: 42 """) sys.stderr = cStringIO.StringIO() @@ -1400,6 +1402,7 @@ Exception ignored from cffi callback , trying to convert t Traceback (most recent call last): File "$", line $, in test_callback_exception $ + $ OverflowError: integer 60000 does not fit 'short' """) sys.stderr = cStringIO.StringIO() @@ -1443,11 +1446,13 @@ Exception ignored from cffi callback , trying to convert t Traceback (most recent call last): File "$", line $, in test_callback_exception $ + $ OverflowError: integer 60000 does not fit 'short' Exception ignored during handling of the above exception by 'onerror': Traceback (most recent call last): File "$", line $, in test_callback_exception $ + $ TypeError: $integer$ """) # @@ -1472,11 +1477,13 @@ Exception ignored from cffi callback , trying to convert t Traceback (most recent call last): File "$", line $, in test_callback_exception $ + $ OverflowError: integer 60000 does not fit 'short' Exception ignored during handling of the above exception by 'onerror': Traceback (most recent call last): File "$", line $, in oops $ + $ AttributeError: 'str' object has no attribute 'append$ """) finally: -- cgit v1.2.1 From 03fea60451afce2b0d30a1e37adc371526245af1 Mon Sep 17 00:00:00 2001 From: Armin Rigo Date: Tue, 1 Feb 2022 07:58:59 +0100 Subject: Backed out changeset: e184bbd523d6 --- c/test_c.py | 7 ------- 1 file changed, 7 deletions(-) (limited to 'c') diff --git a/c/test_c.py b/c/test_c.py index e23c7fe..654584d 100644 --- a/c/test_c.py +++ b/c/test_c.py @@ -1384,10 +1384,8 @@ Exception ignored from cffi callback : Traceback (most recent call last): File "$", line $, in Zcb1 $ - $ File "$", line $, in check_value $ - $ ValueError: 42 """) sys.stderr = cStringIO.StringIO() @@ -1402,7 +1400,6 @@ Exception ignored from cffi callback , trying to convert t Traceback (most recent call last): File "$", line $, in test_callback_exception $ - $ OverflowError: integer 60000 does not fit 'short' """) sys.stderr = cStringIO.StringIO() @@ -1446,13 +1443,11 @@ Exception ignored from cffi callback , trying to convert t Traceback (most recent call last): File "$", line $, in test_callback_exception $ - $ OverflowError: integer 60000 does not fit 'short' Exception ignored during handling of the above exception by 'onerror': Traceback (most recent call last): File "$", line $, in test_callback_exception $ - $ TypeError: $integer$ """) # @@ -1477,13 +1472,11 @@ Exception ignored from cffi callback , trying to convert t Traceback (most recent call last): File "$", line $, in test_callback_exception $ - $ OverflowError: integer 60000 does not fit 'short' Exception ignored during handling of the above exception by 'onerror': Traceback (most recent call last): File "$", line $, in oops $ - $ AttributeError: 'str' object has no attribute 'append$ """) finally: -- cgit v1.2.1 From bd3b3909442c8c8836356eb9ed9d986866f7615d Mon Sep 17 00:00:00 2001 From: Armin Rigo Date: Tue, 1 Feb 2022 08:00:11 +0100 Subject: =?UTF-8?q?apply=20patch=20from=20Tom=C3=A1=C5=A1=20on=20PR=20111?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- c/test_c.py | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) (limited to 'c') diff --git a/c/test_c.py b/c/test_c.py index 654584d..906eb07 100644 --- a/c/test_c.py +++ b/c/test_c.py @@ -1331,9 +1331,11 @@ def test_callback_exception(): except ImportError: import io as cStringIO # Python 3 import linecache - def matches(istr, ipattern, ipattern38): + def matches(istr, ipattern, ipattern38, ipattern311): if sys.version_info >= (3, 8): ipattern = ipattern38 + if sys.version_info >= (3, 11): + ipattern = ipattern311 str, pattern = istr, ipattern while '$' in pattern: i = pattern.index('$') @@ -1387,6 +1389,16 @@ Traceback (most recent call last): File "$", line $, in check_value $ ValueError: 42 +""", """\ +Exception ignored from cffi callback : +Traceback (most recent call last): + File "$", line $, in Zcb1 + $ + $ + File "$", line $, in check_value + $ + $ +ValueError: 42 """) sys.stderr = cStringIO.StringIO() bigvalue = 20000 @@ -1401,6 +1413,13 @@ Traceback (most recent call last): File "$", line $, in test_callback_exception $ OverflowError: integer 60000 does not fit 'short' +""", """\ +Exception ignored from cffi callback , trying to convert the result back to C: +Traceback (most recent call last): + File "$", line $, in test_callback_exception + $ + $ +OverflowError: integer 60000 does not fit 'short' """) sys.stderr = cStringIO.StringIO() bigvalue = 20000 @@ -1449,6 +1468,19 @@ Traceback (most recent call last): File "$", line $, in test_callback_exception $ TypeError: $integer$ +""", """\ +Exception ignored from cffi callback , trying to convert the result back to C: +Traceback (most recent call last): + File "$", line $, in test_callback_exception + $ + $ +OverflowError: integer 60000 does not fit 'short' +Exception ignored during handling of the above exception by 'onerror': +Traceback (most recent call last): + File "$", line $, in test_callback_exception + $ + $ +TypeError: $integer$ """) # sys.stderr = cStringIO.StringIO() @@ -1478,6 +1510,19 @@ Traceback (most recent call last): File "$", line $, in oops $ AttributeError: 'str' object has no attribute 'append$ +""", """\ +Exception ignored from cffi callback , trying to convert the result back to C: +Traceback (most recent call last): + File "$", line $, in test_callback_exception + $ + $ +OverflowError: integer 60000 does not fit 'short' +Exception ignored during handling of the above exception by 'onerror': +Traceback (most recent call last): + File "$", line $, in oops + $ + $ +AttributeError: 'str' object has no attribute 'append$ """) finally: sys.stderr = orig_stderr -- cgit v1.2.1