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

Tests fail with Python 3.11 #25

Closed
icemac opened this issue Feb 11, 2022 · 0 comments · Fixed by #26
Closed

Tests fail with Python 3.11 #25

icemac opened this issue Feb 11, 2022 · 0 comments · Fixed by #26

Comments

@icemac
Copy link
Member

icemac commented Feb 11, 2022

BUG/PROBLEM REPORT (OR OTHER COMMON ISSUE)

What I did:

Run tox -epy311

What I expect to happen:

Successful test run.

What actually happened:

$ tox -epy311
py311 develop-inst-noop: /.../zope.exceptions
py311 installed: alabaster==0.7.12,Babel==2.9.1,certifi==2021.10.8,charset-normalizer==2.0.11,docutils==0.17.1,idna==3.3,imagesize==1.3.0,Jinja2==3.0.3,MarkupSafe==2.0.1,packaging==21.3,Pygments==2.11.2,pyparsing==3.0.7,pytz==2021.3,repoze.sphinx.autointerface==0.8,requests==2.27.1,six==1.16.0,snowballstemmer==2.2.0,Sphinx==4.4.0,sphinxcontrib-applehelp==1.0.2,sphinxcontrib-devhelp==1.0.2,sphinxcontrib-htmlhelp==2.0.0,sphinxcontrib-jsmath==1.0.1,sphinxcontrib-qthelp==1.0.3,sphinxcontrib-serializinghtml==1.1.5,urllib3==1.26.8,-e git+https://github.com/zopefoundation/zope.exceptions@cb2d21400c95b73909b1145674c08fed31b8759a#egg=zope.exceptions,zope.interface==5.4.0,zope.testrunner==5.4.0
py311 run-test-pre: PYTHONHASHSEED='591231223'
py311 run-test: commands[0] | zope-testrunner --test-path=src -vc
Running tests at level 1
Running zope.testrunner.layer.UnitTests tests:
  Set up zope.testrunner.layer.UnitTests in 0.000 seconds.
  Running:
..........................

Failure in test test_recursion_failure (zope.exceptions.tests.test_exceptionformatter.Test_format_exception)
Traceback (most recent call last):
  File "/.../lib/python3.11/unittest/case.py", line 57, in testPartExecutor
    yield
  File "/.../lib/python3.11/unittest/case.py", line 591, in run
    self._callTestMethod(testMethod)
  File "/.../lib/python3.11/unittest/case.py", line 547, in _callTestMethod
    if method() is not None:
  File "/.../zope.exceptions/src/zope/exceptions/tests/test_exceptionformatter.py", line 705, in test_recursion_failure
    self.assertEqual(s.splitlines()[-2],
  File "/.../lib/python3.11/unittest/case.py", line 841, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/.../lib/python3.11/unittest/case.py", line 1192, in assertMultiLineEqual
    self.fail(self._formatMessage(msg, standardMsg))
  File "/.../lib/python3.11/unittest/case.py", line 671, in fail
    raise self.failureException(msg)
AssertionError: '    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^' != '    raise FormatterException("Formatter failed")'
-     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+     raise FormatterException("Formatter failed")


......................

Error in test test_formatException_recursion_in_tb_stack (zope.exceptions.tests.test_exceptionformatter.TextExceptionFormatterTests)
Traceback (most recent call last):
  File "/.../lib/python3.11/unittest/case.py", line 57, in testPartExecutor
    yield
  File "/.../lib/python3.11/unittest/case.py", line 591, in run
    self._callTestMethod(testMethod)
  File "/.../lib/python3.11/unittest/case.py", line 547, in _callTestMethod
    if method() is not None:
  File "/.../zope.exceptions/src/zope/exceptions/tests/test_exceptionformatter.py", line 347, in test_formatException_recursion_in_tb_stack
    lines = fmt.formatException(ValueError, err, tb)
(Recursive formatException() stopped, trying traceback.format_tb)
  File "/.../zope.exceptions/src/zope/exceptions/exceptionformatter.py", line 186, in formatException
    result.extend(traceback.format_tb(tb))
                  ^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../lib/python3.11/traceback.py", line 59, in format_tb
    return extract_tb(tb, limit=limit).format()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../lib/python3.11/traceback.py", line 74, in extract_tb
    return StackSummary._extract_from_extended_frame_gen(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../lib/python3.11/traceback.py", line 416, in _extract_from_extended_frame_gen
    for f, (lineno, end_lineno, colno, end_colno) in frame_gen:
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../lib/python3.11/traceback.py", line 353, in _walk_tb_with_full_positions
    positions = _get_code_position(tb.tb_frame.f_code, tb.tb_lasti)
                                                       ^^^^^^^^^^^
AttributeError: 'DummyTB' object has no attribute 'tb_lasti'

...............................
  Ran 79 tests with 1 failures, 1 errors, 0 skipped in 0.015 seconds.
Tearing down left over layers:
  Tear down zope.testrunner.layer.UnitTests in 0.000 seconds.

Tests with errors:
   test_formatException_recursion_in_tb_stack (zope.exceptions.tests.test_exceptionformatter.TextExceptionFormatterTests)

Tests with failures:
   test_recursion_failure (zope.exceptions.tests.test_exceptionformatter.Test_format_exception)
ERROR: InvocationError for command /.../zope.exceptions/.tox/py311/bin/zope-testrunner --test-path=src -vc (exited with code 1)
_______________________________________________________________________ summary _______________________________________________________________________
ERROR:   py311: commands failed

What version of Python and Zope/Addons I am using:

Python 3.11.0a4 against master.

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

Successfully merging a pull request may close this issue.

1 participant