zopefoundation / zope.testing

Other
4 stars 13 forks source link

Python 3.11 - doctest failure related to enhanced tracebacks #41

Closed hrnciar closed 2 years ago

hrnciar commented 2 years ago

BUG/PROBLEM REPORT (OR OTHER COMMON ISSUE)

What I did:

Built zope.testing with Python 3.11

What I expect to happen:

Successful build

What actually happened:

Build failed. I think this is because the enhanced tracebacks in Python 3.11. I was able to fix it with a dirty patch conditionalizing doctestcase.txt file based on python version.

See downstream PR is Fedora: https://src.fedoraproject.org/rpms/python-zope-testing/pull-request/3

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

Fedora Rawhide Python 3.11.0b3 zope.testing 4.7

Full traceback:


======================================================================
FAIL: /builddir/build/BUILD/zope.testing-4.7/src/zope/testing/doctestcase.txt
Doctest: doctestcase.txt
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python3.11/doctest.py", line 2221, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Failed doctest test for doctestcase.txt
  File "/builddir/build/BUILD/zope.testing-4.7/src/zope/testing/doctestcase.txt", line 0

----------------------------------------------------------------------
File "/builddir/build/BUILD/zope.testing-4.7/src/zope/testing/doctestcase.txt", line 76, in doctestcase.txt
Failed example:
    result = suite.run(unittest.TextTestResult(sys.stdout, True, 3))
Expected:
    test1 (tests.MyTest) ... ok
    test2 (tests.MyTest) ... ok
    test3 (tests.MyTest) ... ok
    test4 (tests.MyTest) ... ok
Got:
    test1 (tests.MyTest.test1) ... ok
    test2 (tests.MyTest.test2) ... ok
    test3 (tests.MyTest.test3) ... ok
    test4 (tests.MyTest.test4) ... ok
----------------------------------------------------------------------
File "/builddir/build/BUILD/zope.testing-4.7/src/zope/testing/doctestcase.txt", line 83, in doctestcase.txt
Failed example:
    result = suite.run(unittest.TextTestResult(sys.stdout, True, 3))
Expected:
    test_loggingsupport (tests.MoreTests) ... ok
    test_renormalizing (tests.MoreTests) ... ok
Got:
    test_loggingsupport (tests.MoreTests.test_loggingsupport) ... ok
    test_renormalizing (tests.MoreTests.test_renormalizing) ... ok
----------------------------------------------------------------------
File "/builddir/build/BUILD/zope.testing-4.7/src/zope/testing/doctestcase.txt", line 309, in doctestcase.txt
Failed example:
    result = suite.run(unittest.TextTestResult(sys.stdout, True, 2))
Expected:
    test2 (tests.MyTest) ... ok
    test3 (tests.MyTest) ... ok
    test4 (tests.MyTest) ... ok
Got:
    test2 (tests.MyTest.test2) ... ok
    test3 (tests.MyTest.test3) ... ok
    test4 (tests.MyTest.test4) ... ok

----------------------------------------------------------------------
Ran 12 tests in 0.157s

FAILED (failures=1)
icemac commented 2 years ago

Thank you for writing this issue #42 for a resolution.