From 0a5920888e2f249e9e1cbd01053bf1ea89a797fc Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Fri, 24 Nov 2023 15:46:46 +0100 Subject: [PATCH] Prepare adaptation of unittests for python 3.11 Apparently, error tracebacks will have extra lines with pointers to the position in the line where the error occurred. --- test/test_log_helpers.py | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/test/test_log_helpers.py b/test/test_log_helpers.py index 46ad2cd..5bafade 100644 --- a/test/test_log_helpers.py +++ b/test/test_log_helpers.py @@ -46,7 +46,8 @@ class LogHelperTest(unittest.TestCase): enumerate(zip(log_reader, expected_contents.splitlines())): if re.match(r'\d{1,2}:\d{2}:\d{2}:\d{3}\s+', actual_line): cmp_line = actual_line[13:].rstrip() - elif re.match(r'\s*File ".+", line \d+, in .+', actual_line): + elif re.match(r'\s*File ".+", line \d+, in .+', actual_line) \ + or re.match(r'\s+~\^~\s*', actual_line): cmp_line = ' TRACEBACK LINE REPLACED' else: cmp_line = actual_line.rstrip() @@ -107,6 +108,7 @@ class LogHelperTest(unittest.TestCase): ' impossible_result = 1/0\n' \ 'ZeroDivisionError: division by zero\n' \ 'info| done testing [regular levelname=INFO]\n' + # will have to add a ' TRACEBACK LINE REPLACED\n' above in future python version self.check_expected_contents(expected_contents) def test_get_logger(self): -- 1.7.1