summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.pre-commit-config.yaml2
-rw-r--r--doc/build/unreleased/360.rst6
-rw-r--r--examples/bench/django/templatetags/bench.py2
-rw-r--r--examples/wsgi/run_wsgi.py9
-rw-r--r--test/test_exceptions.py2
-rw-r--r--test/test_template.py19
-rw-r--r--tox.ini2
7 files changed, 25 insertions, 17 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 9fd0eee..19bc31d 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/python/black
- rev: 21.9b0
+ rev: 22.3.0
hooks:
- id: black
diff --git a/doc/build/unreleased/360.rst b/doc/build/unreleased/360.rst
new file mode 100644
index 0000000..91f0c9e
--- /dev/null
+++ b/doc/build/unreleased/360.rst
@@ -0,0 +1,6 @@
+.. change::
+ :tags: bug, tests
+ :tickets: 360
+
+ Various fixes to the test suite in the area of exception message rendering
+ to accommodate for variability in Python versions as well as Pygments.
diff --git a/examples/bench/django/templatetags/bench.py b/examples/bench/django/templatetags/bench.py
index 1f67937..b5bfe26 100644
--- a/examples/bench/django/templatetags/bench.py
+++ b/examples/bench/django/templatetags/bench.py
@@ -1,4 +1,4 @@
-from django.template import Library, Node, resolve_variable
+from django.template import Library
from django.utils.html import escape
register = Library()
diff --git a/examples/wsgi/run_wsgi.py b/examples/wsgi/run_wsgi.py
index a98f6c6..a51a463 100644
--- a/examples/wsgi/run_wsgi.py
+++ b/examples/wsgi/run_wsgi.py
@@ -1,7 +1,12 @@
#!/usr/bin/python
-import cgi, re, os, posixpath, mimetypes
-from mako.lookup import TemplateLookup
+import cgi
+import mimetypes
+import os
+import posixpath
+import re
+
from mako import exceptions
+from mako.lookup import TemplateLookup
root = "./"
port = 8000
diff --git a/test/test_exceptions.py b/test/test_exceptions.py
index 7a2e6b0..4a90b90 100644
--- a/test/test_exceptions.py
+++ b/test/test_exceptions.py
@@ -173,7 +173,7 @@ ${foobar}
)
assert (
- '<div class="sourceline"><table class="syntax-highlightedtable">'
+ '<table class="syntax-highlightedtable">'
in l.get_template("foo.html").render_unicode()
)
diff --git a/test/test_template.py b/test/test_template.py
index fc1aeca..6e7a309 100644
--- a/test/test_template.py
+++ b/test/test_template.py
@@ -940,18 +940,15 @@ class ControlTest(TemplateTest):
%endfor
"""
)
- assert (
- result_lines(
- t.render(
- y=[
- {"test": "one"},
- {"foo": "bar"},
- {"foo": "bar", "test": "two"},
- ]
- )
+ assert result_lines(
+ t.render(
+ y=[
+ {"test": "one"},
+ {"foo": "bar"},
+ {"foo": "bar", "test": "two"},
+ ]
)
- == ["yes x has test", "no x does not have test", "yes x has test"]
- )
+ ) == ["yes x has test", "no x does not have test", "yes x has test"]
def test_blank_control_1(self):
self._do_memory_test(
diff --git a/tox.ini b/tox.ini
index d8edd3c..6f7cefd 100644
--- a/tox.ini
+++ b/tox.ini
@@ -30,7 +30,7 @@ deps=
pydocstyle<4.0.0
# used by flake8-rst-docstrings
pygments
- black==21.9b0
+ black==22.3.0
commands =
flake8 ./mako/ ./test/ setup.py --exclude test/templates,test/foo {posargs}
black --check .