Skip to content

Commit eae8e3a

Browse files
committed
additional test_exceptions fixes
Various fixes to the test suite in the area of exception message rendering to accommodate for variability in Python versions as well as Pygments. builds on 9b8da4b which also reduced some of the checks for exception message formatting. also updates black to 22.3.0 as there seem to be some dependency issues with the older version Fixes: #360 Change-Id: Ib8916534699e7c57817cf82d53300e50d47d0d50
1 parent 9b8da4b commit eae8e3a

7 files changed

Lines changed: 25 additions & 17 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/python/black
5-
rev: 21.9b0
5+
rev: 22.3.0
66
hooks:
77
- id: black
88

doc/build/unreleased/360.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.. change::
2+
:tags: bug, tests
3+
:tickets: 360
4+
5+
Various fixes to the test suite in the area of exception message rendering
6+
to accommodate for variability in Python versions as well as Pygments.

examples/bench/django/templatetags/bench.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from django.template import Library, Node, resolve_variable
1+
from django.template import Library
22
from django.utils.html import escape
33

44
register = Library()

examples/wsgi/run_wsgi.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
#!/usr/bin/python
2-
import cgi, re, os, posixpath, mimetypes
3-
from mako.lookup import TemplateLookup
2+
import cgi
3+
import mimetypes
4+
import os
5+
import posixpath
6+
import re
7+
48
from mako import exceptions
9+
from mako.lookup import TemplateLookup
510

611
root = "./"
712
port = 8000

test/test_exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def test_format_exceptions_pygments(self):
173173
)
174174

175175
assert (
176-
'<div class="sourceline"><table class="syntax-highlightedtable">'
176+
'<table class="syntax-highlightedtable">'
177177
in l.get_template("foo.html").render_unicode()
178178
)
179179

test/test_template.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -940,18 +940,15 @@ def test_control(self):
940940
%endfor
941941
"""
942942
)
943-
assert (
944-
result_lines(
945-
t.render(
946-
y=[
947-
{"test": "one"},
948-
{"foo": "bar"},
949-
{"foo": "bar", "test": "two"},
950-
]
951-
)
943+
assert result_lines(
944+
t.render(
945+
y=[
946+
{"test": "one"},
947+
{"foo": "bar"},
948+
{"foo": "bar", "test": "two"},
949+
]
952950
)
953-
== ["yes x has test", "no x does not have test", "yes x has test"]
954-
)
951+
) == ["yes x has test", "no x does not have test", "yes x has test"]
955952

956953
def test_blank_control_1(self):
957954
self._do_memory_test(

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ deps=
3030
pydocstyle<4.0.0
3131
# used by flake8-rst-docstrings
3232
pygments
33-
black==21.9b0
33+
black==22.3.0
3434
commands =
3535
flake8 ./mako/ ./test/ setup.py --exclude test/templates,test/foo {posargs}
3636
black --check .

0 commit comments

Comments
 (0)