jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/743570 )
Change subject: [bugfix] Adjust traceback line for Python 3.11 ......................................................................
[bugfix] Adjust traceback line for Python 3.11
Python 3.11 has introduced an enhanced error locations in tracebacks as new feature. Adjust the traceback check in ui_tests.TestTerminalOutput
see: https://docs.python.org/3.11/whatsnew/3.11.html
Bug: T297044 Change-Id: I06961c7c71080b3d6bdde3cf143bea7a86bb5280 --- M tests/ui_tests.py 1 file changed, 3 insertions(+), 1 deletion(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/ui_tests.py b/tests/ui_tests.py index fc7c75f..e9af702 100644 --- a/tests/ui_tests.py +++ b/tests/ui_tests.py @@ -23,6 +23,7 @@ VERBOSE, WARNING, ) +from pywikibot.tools import PYTHON_VERSION from pywikibot.userinterfaces import ( terminal_interface_base, terminal_interface_unix, @@ -212,8 +213,9 @@ self.assertEqual(stderrlines[1], 'Traceback (most recent call last):') self.assertEqual(stderrlines[3], " raise TestExceptionError('Testing Exception')") + end_str = ': Testing Exception' - traceback_line = stderrlines[4] + traceback_line = stderrlines[4 + (PYTHON_VERSION >= (3, 11))] self.assertTrue(traceback_line.endswith(end_str), '\n{!r} does not end with {!r}' .format(traceback_line, end_str))