diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-05-08 19:49:48 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-05-08 20:05:44 -0400 |
commit | eae8e3aaa420f4305450e4f1a55881ea9a46bba0 (patch) | |
tree | cd10db0df59c829076289bd35816dd9fba686090 | |
parent | 9b8da4b1e2bdc025b643f2061aa32bf7ae0c78a8 (diff) | |
download | mako-eae8e3aaa420f4305450e4f1a55881ea9a46bba0.tar.gz |
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 9b8da4b1e2bdc025b643f2061aa32 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
-rw-r--r-- | .pre-commit-config.yaml | 2 | ||||
-rw-r--r-- | doc/build/unreleased/360.rst | 6 | ||||
-rw-r--r-- | examples/bench/django/templatetags/bench.py | 2 | ||||
-rw-r--r-- | examples/wsgi/run_wsgi.py | 9 | ||||
-rw-r--r-- | test/test_exceptions.py | 2 | ||||
-rw-r--r-- | test/test_template.py | 19 | ||||
-rw-r--r-- | tox.ini | 2 |
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( @@ -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 . |