From ed9f08f0b4809862d72c6672031baa3fc0eaf5e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 4 Nov 2021 18:03:06 +0100 Subject: [PATCH] Tests: Adapt expected traceback regexes for Python 3.11.0a1 Fixes https://github.com/pallets/jinja/issues/1526 Before: File ".../broken.html", line 2, in {{ fail() }} File ".../test_debug.py", line 32, in tmpl.render(fail=lambda: 1 / 0) ZeroDivisionError: division by zero After: File ".../broken.html", line 2, in {{ fail() }} ^^^^^^^^^^^^ File ".../test_debug.py", line 32, in tmpl.render(fail=lambda: 1 / 0) ~~^~~ ZeroDivisionError: division by zero --- CHANGES.rst | 1 + tests/test_debug.py | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 14830e058..b71cfe235 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,7 @@ Version 3.1.0 Unreleased +- Fix traceback-matching tests with Python 3.11.0a1 :issue:`1526` Version 3.0.2 ------------- diff --git a/tests/test_debug.py b/tests/test_debug.py index c639bbc29..bc11f401b 100644 --- a/tests/test_debug.py +++ b/tests/test_debug.py @@ -36,9 +36,11 @@ def test(): test, r""" File ".*?broken.html", line 2, in (top-level template code|) - \{\{ fail\(\) \}\} + \{\{ fail\(\) \}\}( + \^{12})? File ".*debug?.pyc?", line \d+, in - tmpl\.render\(fail=lambda: 1 / 0\) + tmpl\.render\(fail=lambda: 1 / 0\)( + ~~\^~~)? ZeroDivisionError: (int(eger)? )?division (or modulo )?by zero """, ) @@ -66,7 +68,8 @@ def test(): test, r""" File ".*debug.pyc?", line \d+, in test - raise TemplateSyntaxError\("wtf", 42\) + raise TemplateSyntaxError\("wtf", 42\)( + \^{36})? (jinja2\.exceptions\.)?TemplateSyntaxError: wtf line 42""", )