From fd3cfc8cbc10c69d0fc633f0393ff7802537c781 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Sun, 27 Nov 2022 08:48:55 -0700 Subject: Updated TestCommonTests for Py 3.11 [skip appveyor] Changed the regex for the explicitly generated exception so it also works on Python 3.11+ with the new 'helpful errors' which can add an extra line to the output trying to show the error (thanks to Bill Deegan) Signed-off-by: Mats Wichmann --- testing/framework/TestCommonTests.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/testing/framework/TestCommonTests.py b/testing/framework/TestCommonTests.py index d6fb03a..743feaf 100644 --- a/testing/framework/TestCommonTests.py +++ b/testing/framework/TestCommonTests.py @@ -1936,21 +1936,21 @@ class run_TestCase(TestCommonTestCase): None """) - expect_stderr = lstrip("""\ - Exception trying to execute: \\[%s, '[^']*pass'\\] - Traceback \\(most recent call last\\): - File "", line \\d+, in (\\?|) - File "[^"]+TestCommon.py", line \\d+, in run - super\\(\\).run\\(\\*\\*kw\\) - File "[^"]+TestCmd.py", line \\d+, in run - p = self.start\\(program=program, - File "[^"]+TestCommon.py", line \\d+, in start - raise e - File "[^"]+TestCommon.py", line \\d+, in start - return super\\(\\).start\\(program, interpreter, arguments, - File "", line \\d+, in raise_exception - TypeError: forced TypeError - """ % re.escape(repr(sys.executable))) + expect_stderr = lstrip(\ +fr"""Exception trying to execute: \[{re.escape(repr(sys.executable))}, '[^']*pass'\] +Traceback \(most recent call last\): + File "", line \d+, in (\?|) + File "[^"]+TestCommon.py", line \d+, in run + super\(\).run\(\*\*kw\) + File "[^"]+TestCmd.py", line \d+, in run + p = self.start\(program=program, +(?:\s*\^*\s)? File \"[^\"]+TestCommon.py\", line \d+, in start + raise e + File "[^"]+TestCommon.py", line \d+, in start + return super\(\).start\(program, interpreter, arguments, +(?:\s*\^*\s)? File \"\", line \d+, in raise_exception +TypeError: forced TypeError +""") expect_stderr = re.compile(expect_stderr, re.M) self.run_execution_test(script, expect_stdout, expect_stderr) -- cgit v0.12