Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.1.4: pytest is failing #338

Closed
kloczek opened this issue Aug 19, 2021 · 5 comments
Closed

1.1.4: pytest is failing #338

kloczek opened this issue Aug 19, 2021 · 5 comments

Comments

@kloczek
Copy link

kloczek commented Aug 19, 2021

I'm trying to package your module as rpm packag. So I'm using typical in such case build, install and test cycle used on building package from non-root account:

  • "setup.py build"
  • "setup.py install --root </install/prefix>"
  • "pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

May I ask for help because few units are failing:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-mako-1.1.4-6.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-mako-1.1.4-6.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -q
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
Using --randomly-seed=3899787145
rootdir: /home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4, configfile: setup.cfg
plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, aspectlib-1.5.2, toolbox-0.5, rerunfailures-9.1.1, requests-mock-1.9.3, cov-2.12.1, pyfakefs-4.5.0, flaky-3.7.0, benchmark-3.4.1, xdist-2.3.0, pylama-7.7.1, datadir-1.3.1, regressions-2.2.0, cases-3.6.3, xprocess-0.18.1, black-0.3.12, checkdocs-2.7.1, anyio-3.3.0, Faker-8.11.0, asyncio-0.15.1, trio-0.7.0, httpbin-1.0.0, subtests-0.5.0, isort-2.0.0, hypothesis-6.14.6, mock-3.6.1, profiling-1.7.0, randomly-3.8.0
collected 471 items

test/ext/test_babelplugin.py ......                                                                                                                                  [  1%]
test/test_exceptions.py ..................                                                                                                                           [  5%]
test/ext/test_linguaplugin.py s                                                                                                                                      [  5%]
test/test_filters.py .................s..s...s....                                                                                                                   [ 11%]
test/test_lexer.py ..........................................                                                                                                        [ 20%]
test/test_lookup.py .........                                                                                                                                        [ 22%]
test/test_lru.py .                                                                                                                                                   [ 22%]
test/test_template.py ...............................................s.........................................                                                      [ 41%]
test/test_pygen.py ............                                                                                                                                      [ 44%]
test/test_call.py .................                                                                                                                                  [ 47%]
test/test_cmd.py .......                                                                                                                                             [ 49%]
test/test_runtime.py .                                                                                                                                               [ 49%]
test/test_loop.py .........................                                                                                                                          [ 54%]
test/test_block.py ...............................                                                                                                                   [ 61%]
test/test_util.py ......                                                                                                                                             [ 62%]
test/test_tgplugin.py ......                                                                                                                                         [ 63%]
test/test_def.py .F.............................                                                                                                                     [ 70%]
test/test_inheritance.py .....F....                                                                                                                                  [ 72%]
test/test_cache.py sssssssssssssssssssssss............................................                                                                               [ 86%]
test/test_namespace.py ................................                                                                                                              [ 93%]
test/test_ast.py ........                                                                                                                                            [ 95%]
. .                                                                                                                                                                  [ 95%]
test/test_ast.py .............s..                                                                                                                                    [ 98%]
test/test_decorators.py F....                                                                                                                                        [100%]

================================================================================= FAILURES =================================================================================
__________________________________________________________________________ DefTest.test_toplevel ___________________________________________________________________________
Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_def.py", line 118, in test_toplevel
    self._do_test(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/__init__.py", line 81, in _do_test
    output = template.render_unicode(**template_args)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/template.py", line 478, in render_unicode
    return runtime._render(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 878, in _render
    _render_context(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 919, in _render_context
    (inherit, lclcontext) = _populate_self_namespace(context, tmpl)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 847, in _populate_self_namespace
    "self:%s" % template.uri,
AttributeError: 'DefTemplate' object has no attribute 'uri'
______________________________________________________________________ InheritanceTest.test_toplevel _______________________________________________________________________
Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_inheritance.py", line 358, in test_toplevel
    assert result_lines(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/template.py", line 473, in render
    return runtime._render(self, self.callable_, args, data)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 878, in _render
    _render_context(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 919, in _render_context
    (inherit, lclcontext) = _populate_self_namespace(context, tmpl)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 847, in _populate_self_namespace
    "self:%s" % template.uri,
AttributeError: 'DefTemplate' object has no attribute 'uri'
__________________________________________________________________ DecoratorTest.test_toplevel_contextual __________________________________________________________________
Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_decorators.py", line 52, in test_toplevel_contextual
    assert (
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/template.py", line 473, in render
    return runtime._render(self, self.callable_, args, data)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 878, in _render
    _render_context(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 919, in _render_context
    (inherit, lclcontext) = _populate_self_namespace(context, tmpl)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 847, in _populate_self_namespace
    "self:%s" % template.uri,
AttributeError: 'DefTemplate' object has no attribute 'uri'
========================================================================= short test summary info ==========================================================================
SKIPPED [1] test/ext/test_linguaplugin.py:29: 'test_extract' skipped: lingua not installed: skipping linguaplugin test
SKIPPED [1] test/test_filters.py:91: 'test_quoting_non_unicode' skipped: Requires Python 2.xx
SKIPPED [1] test/test_filters.py:192: 'test_encode_filter_non_str_we_return_bytes' skipped: Requires Python 2.xx
SKIPPED [1] test/test_filters.py:106: 'test_url_escaping_non_unicode' skipped: Requires Python 2.xx
SKIPPED [1] test/test_template.py:546: 'test_bytestring_passthru' skipped: Requires Python 2.xx
SKIPPED [1] test/test_cache.py:321: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:94: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:500: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:565: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:141: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:192: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:172: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:481: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:552: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:461: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:577: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:220: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:290: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:622: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:440: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:262: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:588: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:408: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:350: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:380: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:515: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:605: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:122: dogpile.cache is required to run these tests
SKIPPED [1] test/test_ast.py:211: 'test_locate_identifiers_15' skipped: Requires Python 2.xx
FAILED test/test_def.py::DefTest::test_toplevel - AttributeError: 'DefTemplate' object has no attribute 'uri'
FAILED test/test_inheritance.py::InheritanceTest::test_toplevel - AttributeError: 'DefTemplate' object has no attribute 'uri'
FAILED test/test_decorators.py::DecoratorTest::test_toplevel_contextual - AttributeError: 'DefTemplate' object has no attribute 'uri'
================================================================ 3 failed, 438 passed, 29 skipped in 14.36s ================================================================
pytest-xprocess reminder::Be sure to terminate the started process by running 'pytest --xkill' if you have not explicitly done so in your fixture with 'xprocess.getinfo(<process_name>).terminate()'.
@kloczek
Copy link
Author

kloczek commented Aug 19, 2021

Hmm issuer is a bit different. I have installed pytest-randomly pytest extension.
On second try pytest produced completely different set of fails.

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-mako-1.1.4-6.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-mako-1.1.4-6.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -q
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
Using --randomly-seed=3264483937
rootdir: /home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4, configfile: setup.cfg
plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, aspectlib-1.5.2, toolbox-0.5, rerunfailures-9.1.1, requests-mock-1.9.3, cov-2.12.1, pyfakefs-4.5.0, flaky-3.7.0, benchmark-3.4.1, xdist-2.3.0, pylama-7.7.1, datadir-1.3.1, regressions-2.2.0, cases-3.6.3, xprocess-0.18.1, black-0.3.12, checkdocs-2.7.1, anyio-3.3.0, Faker-8.11.0, asyncio-0.15.1, trio-0.7.0, httpbin-1.0.0, subtests-0.5.0, isort-2.0.0, hypothesis-6.14.6, mock-3.6.1, profiling-1.7.0, randomly-3.8.0
collected 471 items

test/test_decorators.py .....                                                                                                                                        [  1%]
test/test_block.py ...............................                                                                                                                   [  7%]
test/test_ast.py ...                                                                                                                                                 [  8%]
. .                                                                                                                                                                  [  8%]
test/test_ast.py .................s...                                                                                                                               [ 12%]
test/test_lru.py .                                                                                                                                                   [ 13%]
test/test_filters.py .ss..........s...............                                                                                                                   [ 19%]
test/test_cache.py ............................................sssssssssssssssssssssss                                                                               [ 33%]
test/test_exceptions.py ..................                                                                                                                           [ 37%]
test/test_util.py ......                                                                                                                                             [ 38%]
test/test_template.py ..........FFFFFFFF..........................................................s............                                                      [ 57%]
test/test_cmd.py .......                                                                                                                                             [ 59%]
test/test_namespace.py ................................                                                                                                              [ 65%]
test/ext/test_babelplugin.py ......                                                                                                                                  [ 67%]
test/test_runtime.py .                                                                                                                                               [ 67%]
test/test_inheritance.py ....F.....                                                                                                                                  [ 69%]
test/test_tgplugin.py ......                                                                                                                                         [ 70%]
test/test_pygen.py ............                                                                                                                                      [ 73%]
test/test_lookup.py .........                                                                                                                                        [ 75%]
test/test_loop.py .........................                                                                                                                          [ 80%]
test/test_lexer.py ..........................................                                                                                                        [ 89%]
test/ext/test_linguaplugin.py s                                                                                                                                      [ 89%]
test/test_call.py .................                                                                                                                                  [ 93%]
test/test_def.py ........................F......                                                                                                                     [100%]

================================================================================= FAILURES =================================================================================
_______________________________________________________________ RichTracebackTest.test_unicode_file_runtime ________________________________________________________________
Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_template.py", line 1391, in _do_test_traceback
    template.render_unicode()
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/template.py", line 478, in render_unicode
    return runtime._render(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 878, in _render
    _render_context(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 920, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 947, in _exec_template
    callable_(context, *args, **kwargs)
  File "_home_tkloczko_rpmbuild_BUILD_mako_rel_1_1_4_test_templates_unicode_runtime_error_html", line 21, in render_body
ZeroDivisionError: division by zero

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_template.py", line 1406, in _do_test
    self._do_test_traceback(utf8, memory, syntax)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_template.py", line 1398, in _do_test_traceback
    assert tback.source == source
AssertionError: assert '' == '## -*- codin...+ int(5/0) %>'
  - ## -*- coding: utf-8 -*-
  - <% x = 'Alors vous imaginez ma surprise, au lever du jour, quand une drôle de petite voix m’a réveillé. Elle disait: « S’il vous plaît… dessine-moi un mouton! »' + int(5/0) %>
_________________________________________________________________ RichTracebackTest.test_utf8_file_runtime _________________________________________________________________
Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_template.py", line 1391, in _do_test_traceback
    template.render_unicode()
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/template.py", line 478, in render_unicode
    return runtime._render(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 878, in _render
    _render_context(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 920, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 947, in _exec_template
    callable_(context, *args, **kwargs)
  File "_home_tkloczko_rpmbuild_BUILD_mako_rel_1_1_4_test_templates_unicode_runtime_error_html", line 21, in render_body
ZeroDivisionError: division by zero

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_template.py", line 1406, in _do_test
    self._do_test_traceback(utf8, memory, syntax)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_template.py", line 1398, in _do_test_traceback
    assert tback.source == source
AssertionError: assert '' == '## -*- codin...+ int(5/0) %>'
  - ## -*- coding: utf-8 -*-
  - <% x = 'Alors vous imaginez ma surprise, au lever du jour, quand une drôle de petite voix m’a réveillé. Elle disait: « S’il vous plaît… dessine-moi un mouton! »' + int(5/0) %>
_________________________________________________________________ RichTracebackTest.test_utf8_file_syntax __________________________________________________________________
Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_template.py", line 1391, in _do_test_traceback
    template.render_unicode()
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/template.py", line 478, in render_unicode
    return runtime._render(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 878, in _render
    _render_context(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 920, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 947, in _exec_template
    callable_(context, *args, **kwargs)
  File "_home_tkloczko_rpmbuild_BUILD_mako_rel_1_1_4_test_templates_unicode_runtime_error_html", line 21, in render_body
ZeroDivisionError: division by zero

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_template.py", line 1406, in _do_test
    self._do_test_traceback(utf8, memory, syntax)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_template.py", line 1398, in _do_test_traceback
    assert tback.source == source
AssertionError: assert '' == '## -*- codin...+ int(5/0) %>'
  - ## -*- coding: utf-8 -*-
  - <% x = 'Alors vous imaginez ma surprise, au lever du jour, quand une drôle de petite voix m’a réveillé. Elle disait: « S’il vous plaît… dessine-moi un mouton! »' + int(5/0) %>
_______________________________________________________________ RichTracebackTest.test_unicode_memory_syntax _______________________________________________________________
Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_template.py", line 1391, in _do_test_traceback
    template.render_unicode()
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/template.py", line 478, in render_unicode
    return runtime._render(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 878, in _render
    _render_context(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 920, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 947, in _exec_template
    callable_(context, *args, **kwargs)
  File "_home_tkloczko_rpmbuild_BUILD_mako_rel_1_1_4_test_templates_unicode_runtime_error_html", line 21, in render_body
ZeroDivisionError: division by zero

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_template.py", line 1406, in _do_test
    self._do_test_traceback(utf8, memory, syntax)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_template.py", line 1398, in _do_test_traceback
    assert tback.source == source
AssertionError: assert '' == '## -*- codin...+ int(5/0) %>'
  - ## -*- coding: utf-8 -*-
  - <% x = 'Alors vous imaginez ma surprise, au lever du jour, quand une drôle de petite voix m’a réveillé. Elle disait: « S’il vous plaît… dessine-moi un mouton! »' + int(5/0) %>
______________________________________________________________ RichTracebackTest.test_unicode_memory_runtime _______________________________________________________________
Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_template.py", line 1391, in _do_test_traceback
    template.render_unicode()
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/template.py", line 478, in render_unicode
    return runtime._render(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 878, in _render
    _render_context(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 920, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 947, in _exec_template
    callable_(context, *args, **kwargs)
  File "_home_tkloczko_rpmbuild_BUILD_mako_rel_1_1_4_test_templates_unicode_runtime_error_html", line 21, in render_body
ZeroDivisionError: division by zero

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_template.py", line 1406, in _do_test
    self._do_test_traceback(utf8, memory, syntax)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_template.py", line 1398, in _do_test_traceback
    assert tback.source == source
AssertionError: assert '' == '## -*- codin...+ int(5/0) %>'
  - ## -*- coding: utf-8 -*-
  - <% x = 'Alors vous imaginez ma surprise, au lever du jour, quand une drôle de petite voix m’a réveillé. Elle disait: « S’il vous plaît… dessine-moi un mouton! »' + int(5/0) %>
________________________________________________________________ RichTracebackTest.test_unicode_file_syntax ________________________________________________________________
Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_template.py", line 1391, in _do_test_traceback
    template.render_unicode()
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/template.py", line 478, in render_unicode
    return runtime._render(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 878, in _render
    _render_context(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 920, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 947, in _exec_template
    callable_(context, *args, **kwargs)
  File "_home_tkloczko_rpmbuild_BUILD_mako_rel_1_1_4_test_templates_unicode_runtime_error_html", line 21, in render_body
ZeroDivisionError: division by zero

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_template.py", line 1406, in _do_test
    self._do_test_traceback(utf8, memory, syntax)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_template.py", line 1398, in _do_test_traceback
    assert tback.source == source
AssertionError: assert '' == '## -*- codin...+ int(5/0) %>'
  - ## -*- coding: utf-8 -*-
  - <% x = 'Alors vous imaginez ma surprise, au lever du jour, quand une drôle de petite voix m’a réveillé. Elle disait: « S’il vous plaît… dessine-moi un mouton! »' + int(5/0) %>
________________________________________________________________ RichTracebackTest.test_utf8_memory_runtime ________________________________________________________________
Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_template.py", line 1391, in _do_test_traceback
    template.render_unicode()
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/template.py", line 478, in render_unicode
    return runtime._render(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 878, in _render
    _render_context(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 920, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 947, in _exec_template
    callable_(context, *args, **kwargs)
  File "_home_tkloczko_rpmbuild_BUILD_mako_rel_1_1_4_test_templates_unicode_runtime_error_html", line 21, in render_body
ZeroDivisionError: division by zero

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_template.py", line 1406, in _do_test
    self._do_test_traceback(utf8, memory, syntax)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_template.py", line 1398, in _do_test_traceback
    assert tback.source == source
AssertionError: assert '' == '## -*- codin...+ int(5/0) %>'
  - ## -*- coding: utf-8 -*-
  - <% x = 'Alors vous imaginez ma surprise, au lever du jour, quand une drôle de petite voix m’a réveillé. Elle disait: « S’il vous plaît… dessine-moi un mouton! »' + int(5/0) %>
________________________________________________________________ RichTracebackTest.test_utf8_memory_syntax _________________________________________________________________
Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_template.py", line 1391, in _do_test_traceback
    template.render_unicode()
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/template.py", line 478, in render_unicode
    return runtime._render(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 878, in _render
    _render_context(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 920, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 947, in _exec_template
    callable_(context, *args, **kwargs)
  File "_home_tkloczko_rpmbuild_BUILD_mako_rel_1_1_4_test_templates_unicode_runtime_error_html", line 21, in render_body
ZeroDivisionError: division by zero

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_template.py", line 1406, in _do_test
    self._do_test_traceback(utf8, memory, syntax)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_template.py", line 1398, in _do_test_traceback
    assert tback.source == source
AssertionError: assert '' == '## -*- codin...+ int(5/0) %>'
  - ## -*- coding: utf-8 -*-
  - <% x = 'Alors vous imaginez ma surprise, au lever du jour, quand une drôle de petite voix m’a réveillé. Elle disait: « S’il vous plaît… dessine-moi un mouton! »' + int(5/0) %>
______________________________________________________________________ InheritanceTest.test_toplevel _______________________________________________________________________
Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_inheritance.py", line 358, in test_toplevel
    assert result_lines(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/template.py", line 473, in render
    return runtime._render(self, self.callable_, args, data)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 878, in _render
    _render_context(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 919, in _render_context
    (inherit, lclcontext) = _populate_self_namespace(context, tmpl)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 847, in _populate_self_namespace
    "self:%s" % template.uri,
AttributeError: 'DefTemplate' object has no attribute 'uri'
__________________________________________________________________________ DefTest.test_toplevel ___________________________________________________________________________
Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/test_def.py", line 118, in test_toplevel
    self._do_test(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/test/__init__.py", line 81, in _do_test
    output = template.render_unicode(**template_args)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/template.py", line 478, in render_unicode
    return runtime._render(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 878, in _render
    _render_context(
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 919, in _render_context
    (inherit, lclcontext) = _populate_self_namespace(context, tmpl)
  File "/home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4/mako/runtime.py", line 847, in _populate_self_namespace
    "self:%s" % template.uri,
AttributeError: 'DefTemplate' object has no attribute 'uri'
========================================================================= short test summary info ==========================================================================
SKIPPED [1] test/test_ast.py:211: 'test_locate_identifiers_15' skipped: Requires Python 2.xx
SKIPPED [1] test/test_filters.py:106: 'test_url_escaping_non_unicode' skipped: Requires Python 2.xx
SKIPPED [1] test/test_filters.py:91: 'test_quoting_non_unicode' skipped: Requires Python 2.xx
SKIPPED [1] test/test_filters.py:192: 'test_encode_filter_non_str_we_return_bytes' skipped: Requires Python 2.xx
SKIPPED [1] test/test_cache.py:565: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:172: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:461: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:122: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:515: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:262: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:94: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:321: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:141: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:500: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:588: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:220: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:622: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:192: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:380: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:350: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:408: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:552: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:481: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:605: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:290: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:440: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:577: dogpile.cache is required to run these tests
SKIPPED [1] test/test_template.py:546: 'test_bytestring_passthru' skipped: Requires Python 2.xx
SKIPPED [1] test/ext/test_linguaplugin.py:29: 'test_extract' skipped: lingua not installed: skipping linguaplugin test
FAILED test/test_template.py::RichTracebackTest::test_unicode_file_runtime - AssertionError: assert '' == '## -*- codin...+ int(5/0) %>'
FAILED test/test_template.py::RichTracebackTest::test_utf8_file_runtime - AssertionError: assert '' == '## -*- codin...+ int(5/0) %>'
FAILED test/test_template.py::RichTracebackTest::test_utf8_file_syntax - AssertionError: assert '' == '## -*- codin...+ int(5/0) %>'
FAILED test/test_template.py::RichTracebackTest::test_unicode_memory_syntax - AssertionError: assert '' == '## -*- codin...+ int(5/0) %>'
FAILED test/test_template.py::RichTracebackTest::test_unicode_memory_runtime - AssertionError: assert '' == '## -*- codin...+ int(5/0) %>'
FAILED test/test_template.py::RichTracebackTest::test_unicode_file_syntax - AssertionError: assert '' == '## -*- codin...+ int(5/0) %>'
FAILED test/test_template.py::RichTracebackTest::test_utf8_memory_runtime - AssertionError: assert '' == '## -*- codin...+ int(5/0) %>'
FAILED test/test_template.py::RichTracebackTest::test_utf8_memory_syntax - AssertionError: assert '' == '## -*- codin...+ int(5/0) %>'
FAILED test/test_inheritance.py::InheritanceTest::test_toplevel - AttributeError: 'DefTemplate' object has no attribute 'uri'
FAILED test/test_def.py::DefTest::test_toplevel - AttributeError: 'DefTemplate' object has no attribute 'uri'
=============================================================== 10 failed, 431 passed, 29 skipped in 14.43s ================================================================
pytest-xprocess reminder::Be sure to terminate the started process by running 'pytest --xkill' if you have not explicitly done so in your fixture with 'xprocess.getinfo(<process_name>).terminate()'.

In otherr words looks like there are some dependencies between test units and reshufling them in random order breaks those depencdencies.
Temporary workaround: run pytest with '-p no:randomly`
It is some module which allows detect that kind of issues.

@kloczek
Copy link
Author

kloczek commented Aug 19, 2021

Here is the tool which allow diagnose that kind of issues https://github.com/mrbean-bremen/pytest-find-dependencies/
Just tested and when pytest-no:randomly is disabled everything is fine.

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-mako-1.1.4-6.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-mako-1.1.4-6.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.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/tkloczko/rpmbuild/BUILD/mako-rel_1_1_4, configfile: setup.cfg
plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, aspectlib-1.5.2, toolbox-0.5, rerunfailures-9.1.1, requests-mock-1.9.3, cov-2.12.1, pyfakefs-4.5.0, flaky-3.7.0, benchmark-3.4.1, xdist-2.3.0, pylama-7.7.1, datadir-1.3.1, regressions-2.2.0, cases-3.6.3, xprocess-0.18.1, black-0.3.12, checkdocs-2.7.1, anyio-3.3.0, Faker-8.11.0, asyncio-0.15.1, trio-0.7.0, httpbin-1.0.0, subtests-0.5.0, isort-2.0.0, hypothesis-6.14.6, mock-3.6.1, profiling-1.7.0
collected 471 items

. .                                                                                                                                                                  [  0%]
test/test_ast.py ...........s............                                                                                                                            [  5%]
test/test_block.py ...............................                                                                                                                   [ 11%]
test/test_cache.py ............................................sssssssssssssssssssssss                                                                               [ 26%]
test/test_call.py .................                                                                                                                                  [ 29%]
test/test_cmd.py .......                                                                                                                                             [ 31%]
test/test_decorators.py .....                                                                                                                                        [ 32%]
test/test_def.py ...............................                                                                                                                     [ 38%]
test/test_exceptions.py ..................                                                                                                                           [ 42%]
test/test_filters.py .........s.........s..s......                                                                                                                   [ 48%]
test/test_inheritance.py ..........                                                                                                                                  [ 51%]
test/test_lexer.py ..........................................                                                                                                        [ 60%]
test/test_lookup.py .........                                                                                                                                        [ 61%]
test/test_loop.py .........................                                                                                                                          [ 67%]
test/test_lru.py .                                                                                                                                                   [ 67%]
test/test_namespace.py ................................                                                                                                              [ 74%]
test/test_pygen.py ............                                                                                                                                      [ 76%]
test/test_runtime.py .                                                                                                                                               [ 77%]
test/test_template.py s........................................................................................                                                      [ 95%]
test/test_tgplugin.py ......                                                                                                                                         [ 97%]
test/test_util.py ......                                                                                                                                             [ 98%]
test/ext/test_babelplugin.py ......                                                                                                                                  [ 99%]
test/ext/test_linguaplugin.py s                                                                                                                                      [100%]

========================================================================= short test summary info ==========================================================================
SKIPPED [1] test/test_ast.py:211: 'test_locate_identifiers_15' skipped: Requires Python 2.xx
SKIPPED [1] test/test_cache.py:380: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:440: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:122: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:605: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:565: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:552: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:577: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:94: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:192: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:220: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:262: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:321: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:290: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:408: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:350: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:515: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:461: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:500: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:481: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:141: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:172: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:588: dogpile.cache is required to run these tests
SKIPPED [1] test/test_cache.py:622: dogpile.cache is required to run these tests
SKIPPED [1] test/test_filters.py:192: 'test_encode_filter_non_str_we_return_bytes' skipped: Requires Python 2.xx
SKIPPED [1] test/test_filters.py:91: 'test_quoting_non_unicode' skipped: Requires Python 2.xx
SKIPPED [1] test/test_filters.py:106: 'test_url_escaping_non_unicode' skipped: Requires Python 2.xx
SKIPPED [1] test/test_template.py:546: 'test_bytestring_passthru' skipped: Requires Python 2.xx
SKIPPED [1] test/ext/test_linguaplugin.py:29: 'test_extract' skipped: lingua not installed: skipping linguaplugin test
===================================================================== 441 passed, 29 skipped in 14.03s =====================================================================
pytest-xprocess reminder::Be sure to terminate the started process by running 'pytest --xkill' if you have not explicitly done so in your fixture with 'xprocess.getinfo(<process_name>).terminate()'.

@zzzeek
Copy link
Member

zzzeek commented Aug 19, 2021

one is a regression from 9270047

zzzeek referenced this issue Aug 19, 2021
Fixed Python deprecation issues related to module importing, as well as
file access within the Lingua plugin, for deprecated APIs that began to
emit warnings under Python 3.10.  Pull request courtesy Petr Viktorin.

This modernizes the code to avoid `DeprecationWarning` and `ResourceWarning` encountered in the test suite under Python 3.10a4:
- [load_module](https://docs.python.org/3/library/importlib.html#importlib.abc.Loader.load_module) is deprecated
- Some files weren't being closed

This changes the semantics of the `compat.load_module` function: on Python 3.5+, the module is no longer inserted in `sys.modules`. All non-test calls did `del sys.modules[self.module_id]` right after the call, anyway. On older Python, the module is inserted and then deleted.

(Some additional `DeprecationWarning` come from Setuptools: pypa/setuptools#2517)

Closes: #328
Pull-request: #328
Pull-request-sha: 87c1d09

Change-Id: I9cb3772f6812ef14297792344caf2f9aa5337adf
@sqla-tester
Copy link
Collaborator

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

dont intefere with mako.templates in the test suite https://gerrit.sqlalchemy.org/c/sqlalchemy/mako/+/3009

@zzzeek
Copy link
Member

zzzeek commented Aug 19, 2021

let me know if you can confirm this fix on your end from master, otherwise I can just release it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants