sqlalchemy / mako

Mako Templates for Python
https://www.makotemplates.org
MIT License
353 stars 60 forks source link

1.2.0: pytest is failing #360

Closed kloczek closed 2 years ago

kloczek commented 2 years ago

I'm trying to package your module as an rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-mako-1.2.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-mako-1.2.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -q -p no:randomly
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/mako-rel_1_2_0, configfile: setup.cfg
collected 442 items

test/test_ast.py .......................                                                                                                                             [  5%]
test/test_block.py ...............................                                                                                                                   [ 12%]
test/test_cache.py .....................ssssssssssssssssssssssssssssssssssssssssssssss                                                                               [ 27%]
test/test_call.py .................                                                                                                                                  [ 31%]
test/test_cmd.py .......                                                                                                                                             [ 32%]
test/test_decorators.py .....                                                                                                                                        [ 33%]
test/test_def.py ...............................                                                                                                                     [ 40%]
test/test_exceptions.py .......F..........                                                                                                                           [ 45%]
test/test_filters.py ..........................                                                                                                                      [ 50%]
test/test_inheritance.py ..........                                                                                                                                  [ 53%]
test/test_lexer.py ..........................................                                                                                                        [ 62%]
test/test_lookup.py ..........                                                                                                                                       [ 64%]
test/test_lru.py .                                                                                                                                                   [ 65%]
test/test_namespace.py .................................                                                                                                             [ 72%]
test/test_pygen.py ............                                                                                                                                      [ 75%]
test/test_runtime.py .                                                                                                                                               [ 75%]
test/test_template.py ......................................................................................                                                         [ 95%]
test/test_util.py ......                                                                                                                                             [ 96%]
test/ext/test_babelplugin.py ......                                                                                                                                  [ 97%]
test/ext/test_linguaplugin.py .                                                                                                                                      [ 97%]
test/testing/test_config.py .........                                                                                                                                [100%]

================================================================================= FAILURES =================================================================================
______________________________________________________________ ExceptionsTest.test_format_exceptions_pygments ______________________________________________________________
Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_2_0/test/test_exceptions.py", line 175, in test_format_exceptions_pygments
    assert (
AssertionError: assert '<div class="sourceline"><table class="syntax-highlightedtable">' in '\n\n\n<html>\n<head>\n    <title>Mako Runtime Error</title>\n    <style>\n        body { font-family:verdana; margin:.../span><span class="p">)</span>\n</pre></div></td></tr></table></div>\n</div>\n    </div>\n</div>\n\n</body>\n</html>\n'
 +  where '\n\n\n<html>\n<head>\n    <title>Mako Runtime Error</title>\n    <style>\n        body { font-family:verdana; margin:.../span><span class="p">)</span>\n</pre></div></td></tr></table></div>\n</div>\n    </div>\n</div>\n\n</body>\n</html>\n' = <bound method Template.render_unicode of <mako.template.Template object at 0x7fcb43d353a0>>()
 +    where <bound method Template.render_unicode of <mako.template.Template object at 0x7fcb43d353a0>> = <mako.template.Template object at 0x7fcb43d353a0>.render_unicode
 +      where <mako.template.Template object at 0x7fcb43d353a0> = <bound method TemplateLookup.get_template of <mako.lookup.TemplateLookup object at 0x7fcb43d35df0>>('foo.html')
 +        where <bound method TemplateLookup.get_template of <mako.lookup.TemplateLookup object at 0x7fcb43d35df0>> = <mako.lookup.TemplateLookup object at 0x7fcb43d35df0>.get_template
========================================================================= short test summary info ==========================================================================
SKIPPED [1] test/test_cache.py:92: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:120: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:139: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:170: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:190: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:218: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:260: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:288: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:319: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:348: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:378: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:406: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:438: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:459: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:479: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:498: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:513: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:550: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:563: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:575: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:586: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:603: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:620: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:92: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:120: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:139: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:170: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:190: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:218: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:260: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:288: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:319: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:348: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:378: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:406: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:438: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:459: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:479: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:498: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:513: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:550: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:563: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:575: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:586: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:603: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:620: dogpile.cache is required to run these tests
FAILED test/test_exceptions.py::ExceptionsTest::test_format_exceptions_pygments - assert '<div class="sourceline"><table class="syntax-highlightedtable">' in '\n\n\n<htm...
================================================================ 1 failed, 395 passed, 46 skipped in 3.26s =================================================================

List of modules installed in build env

Package                       Version
----------------------------- -----------------
alabaster                     0.7.12
attrs                         21.4.0
Babel                         2.10.1
Brlapi                        0.8.3
build                         0.7.0
Chameleon                     3.9.1
changelog                     0.5.7
charset-normalizer            2.0.12
click                         8.1.2
codespell                     2.1.0
cycler                        0.11.0
distro                        1.7.0
docutils                      0.17.1
extras                        1.0.0
fixtures                      4.0.0
fonttools                     4.33.3
gpg                           1.17.1-unknown
idna                          3.3
imagesize                     1.3.0
importlib-metadata            4.11.3
iniconfig                     1.1.1
Jinja2                        3.1.1
kiwisolver                    1.3.2
libcomps                      0.1.18
libsass                       0.21.0
lingua                        4.14.0
louis                         3.21.0
Mako                          1.2.0.dev0
MarkupSafe                    2.1.1
matplotlib                    3.5.1
numpy                         1.22.3
olefile                       0.46
packaging                     21.3
pbr                           5.8.1
pep517                        0.12.0
Pillow                        9.1.0
pip                           22.0.4
pluggy                        1.0.0
polib                         1.1.1
py                            1.11.0
Pygments                      2.12.0
PyGObject                     3.42.1
pyparsing                     3.0.8
pytest                        7.1.2
python-dateutil               2.8.2
pytz                          2022.1
requests                      2.27.1
rpm                           4.17.0
setuptools                    62.0.0
six                           1.16.0
snowballstemmer               2.2.0
Sphinx                        4.5.0
sphinx-paramlinks             0.5.2
sphinxcontrib-applehelp       1.0.2.dev20220410
sphinxcontrib-devhelp         1.0.2.dev20220410
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1.dev20220410
sphinxcontrib-qthelp          1.0.3.dev20220410
sphinxcontrib-serializinghtml 1.1.5
testtools                     2.5.0
tomli                         2.0.1
urllib3                       1.26.9
wheel                         0.37.1
zipp                          3.8.0
zzzeeksphinx                  1.3.3
zzzeek commented 2 years ago

should be fixed in 9b8da4b1e2bdc025b643f2061aa32bf7ae0c if you can please confirm

zzzeek commented 2 years ago

or not. i can't reproduce that one in py38 locally. but those exception tests are very brittle. update: OK with later pygments I can.

sqla-tester commented 2 years ago

Mike Bayer has proposed a fix for this issue in the main branch:

additional test_exceptions fixes https://gerrit.sqlalchemy.org/c/sqlalchemy/mako/+/3827

kloczek commented 2 years ago

Just tested 1.2.1 and all look sclean 👍

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-mako-1.2.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-mako-1.2.1-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -q -p no:randomly
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/mako-rel_1_2_1, configfile: setup.cfg
collected 442 items

test/test_ast.py .......................                                                                                                                             [  5%]
test/test_block.py ...............................                                                                                                                   [ 12%]
test/test_cache.py .....................ssssssssssssssssssssssssssssssssssssssssssssss                                                                               [ 27%]
test/test_call.py .................                                                                                                                                  [ 31%]
test/test_cmd.py .......                                                                                                                                             [ 32%]
test/test_decorators.py .....                                                                                                                                        [ 33%]
test/test_def.py ...............................                                                                                                                     [ 40%]
test/test_exceptions.py ..................                                                                                                                           [ 45%]
test/test_filters.py ..........................                                                                                                                      [ 50%]
test/test_inheritance.py ..........                                                                                                                                  [ 53%]
test/test_lexer.py ..........................................                                                                                                        [ 62%]
test/test_lookup.py ..........                                                                                                                                       [ 64%]
test/test_lru.py .                                                                                                                                                   [ 65%]
test/test_namespace.py .................................                                                                                                             [ 72%]
test/test_pygen.py ............                                                                                                                                      [ 75%]
test/test_runtime.py .                                                                                                                                               [ 75%]
test/test_template.py ......................................................................................                                                         [ 95%]
test/test_util.py ......                                                                                                                                             [ 96%]
test/ext/test_babelplugin.py ......                                                                                                                                  [ 97%]
test/ext/test_linguaplugin.py .                                                                                                                                      [ 97%]
test/testing/test_config.py .........                                                                                                                                [100%]

========================================================================= short test summary info ==========================================================================
SKIPPED [1] test/test_cache.py:92: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:120: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:139: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:170: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:190: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:218: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:260: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:288: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:319: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:348: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:378: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:406: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:438: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:459: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:479: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:498: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:513: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:550: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:563: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:575: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:586: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:603: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:620: Beaker is required for these tests.
SKIPPED [1] test/test_cache.py:92: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:120: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:139: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:170: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:190: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:218: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:260: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:288: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:319: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:348: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:378: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:406: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:438: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:459: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:479: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:498: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:513: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:550: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:563: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:575: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:586: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:603: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:620: dogpile.cache is required to run these tests
===================================================================== 396 passed, 46 skipped in 3.13s ======================================================================