zopefoundation / zope.exceptions

exceptions and implementations which are general purpose
https://zopeexceptions.readthedocs.io/
Other
0 stars 6 forks source link

test_format_exception_as_html fails with Python 3.13 #34

Open mgorny opened 2 weeks ago

mgorny commented 2 weeks ago

BUG/PROBLEM REPORT / FEATURE REQUEST

What I did:

Run tests with Python 3.13.0b2 (tox -e py313).

What I expect to happen:

Tests passing.

What actually happened:

Failure in test test_format_exception_as_html (zope.exceptions.tests.test_exceptionformatter.Test_format_exception.test_format_exception_as_html)
Traceback (most recent call last):
  File "/usr/lib/python3.13/unittest/case.py", line 58, in testPartExecutor
    yield
  File "/usr/lib/python3.13/unittest/case.py", line 651, in run
    self._callTestMethod(testMethod)
  File "/usr/lib/python3.13/unittest/case.py", line 606, in _callTestMethod
    if method() is not None:
  File "/tmp/zope.exceptions/src/zope/exceptions/tests/test_exceptionformatter.py", line 779, in test_format_exception_as_html
    self.assertEqual(expected, result)
  File "/usr/lib/python3.13/unittest/case.py", line 907, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/usr/lib/python3.13/unittest/case.py", line 1273, in assertMultiLineEqual
    self.fail(self._formatMessage(msg, standardMsg))
  File "/usr/lib/python3.13/unittest/case.py", line 732, in fail
    raise self.failureException(msg)
AssertionError: '<p>T[272 chars]Error: invalid syntax<br />\n</p>' != '<p>T[272 chars]Error: Expected one or more names after \'import\'<br />\n</p>'
  <p>Traceback (most recent call last):</p>
  <ul>
  <li>  Module zope.exceptions.tests.test_exceptionformatter, line ABC, in test_format_exception_as_html<br />
      exec('import')</li>
  </ul><p>  File "&lt;string&gt;", line 1<br />
      import<br />
            ^<br />
- SyntaxError: invalid syntax<br />
+ SyntaxError: Expected one or more names after 'import'<br />
  </p>

Apparently it's just a matter of improved exception message.

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

Gentoo Linux amd64 Python 3.13.0b2 zope.exceptions 69ee8af262c40432e237202dc20fc3ae5d5ee5a6

icemac commented 2 weeks ago

@mgorny Thank you for reporting. I'll put it onto the list of issues needed to solve to support Python 3.13.