Bug 2067200 - fonttools fails to build with Python 3.11: AssertionError: assert 'UFOFormatVersion.FORMAT_3_0' == '3.0'
Summary: fonttools fails to build with Python 3.11: AssertionError: assert 'UFOFormatV...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: fonttools
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
Assignee: Parag Nemade
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.11
TreeView+ depends on / blocked
 
Reported: 2022-03-23 14:06 UTC by Tomáš Hrnčiar
Modified: 2022-06-22 11:49 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2022-06-22 11:49:14 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2022-03-23 14:06:52 UTC
fonttools fails to build with Python 3.11.0a6.

=================================== FAILURES ===================================
___________________________ test_formatVersionTuple ____________________________

ufo_path = PosixPath('/tmp/pytest-of-mockbuild/pytest-0/test_formatVersionTuple0/TestFont.ufo')

    def test_formatVersionTuple(ufo_path):
        reader = UFOReader(ufo_path)
    
        assert reader.formatVersionTuple == (3, 0)
        assert reader.formatVersionTuple.major == 3
        assert reader.formatVersionTuple.minor == 0
>       assert str(reader.formatVersionTuple) == "3.0"
E       AssertionError: assert 'UFOFormatVersion.FORMAT_3_0' == '3.0'
E         - 3.0
E         + UFOFormatVersion.FORMAT_3_0


https://docs.python.org/3.11/whatsnew/3.11.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.11/fedora-rawhide-x86_64/03814609-fonttools/

For all our attempts to build fonttools with Python 3.11, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/fonttools/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.11:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/

Let us know here if you have any questions.

Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Miro Hrončok 2022-06-14 15:48:53 UTC
fonttools is currently one of the biggest blockers of the Python 3.11 mass rebuild currently in progress. Hence, setting the severity to urgent.

I believe the problem reported here is just a bad enum str() expectation in the tests. 


However, there are now 2 failures:

=================================== FAILURES ===================================
____________________ TestCu2QuPen.test_ignore_single_points ____________________
self = <pens.cu2quPen_test.TestCu2QuPen testMethod=test_ignore_single_points>
    def test_ignore_single_points(self):
        pen = DummyPen()
        try:
            logging.captureWarnings(True)
            with CapturingLogHandler("py.warnings", level="WARNING") as log:
                quadpen = Cu2QuPen(pen, MAX_ERR, ignore_single_points=True)
        finally:
            logging.captureWarnings(False)
        quadpen.moveTo((0, 0))
        quadpen.endPath()
        quadpen.moveTo((1, 1))
        quadpen.closePath()
    
        self.assertGreaterEqual(len(log.records), 1)
        self.assertIn("ignore_single_points is deprecated",
>                     log.records[0].args[0])
E       IndexError: tuple index out of range
Tests/pens/cu2quPen_test.py:261: IndexError
___________________________ test_formatVersionTuple ____________________________
ufo_path = PosixPath('/tmp/pytest-of-mockbuild/pytest-0/test_formatVersionTuple0/TestFont.ufo')
    def test_formatVersionTuple(ufo_path):
        reader = UFOReader(ufo_path)
    
        assert reader.formatVersionTuple == (3, 0)
        assert reader.formatVersionTuple.major == 3
        assert reader.formatVersionTuple.minor == 0
>       assert str(reader.formatVersionTuple) == "3.0"
E       AssertionError: assert 'UFOFormatVersion.FORMAT_3_0' == '3.0'
E         - 3.0
E         + UFOFormatVersion.FORMAT_3_0
Tests/ufoLib/ufoLib_test.py:38: AssertionError

Comment 2 Miro Hrončok 2022-06-15 10:06:38 UTC
Considering the severity of this, I've pushed a patch downstream: https://src.fedoraproject.org/rpms/fonttools/c/56762bce3fbd532389751251f0177c27be1864ce?branch=rawhide

 	
Parag, could you please bring this to upstream? Thanks.

Comment 3 Parag Nemade 2022-06-15 13:04:21 UTC
Thanks for fixing this quickly. Submitted upstream PR https://github.com/fonttools/fonttools/pull/2655

Comment 4 Miro Hrončok 2022-06-22 11:49:14 UTC
Closing this in bulk as it built with Python 3.11. If this needs to remain open for a followup, feel free to reopen, I won't close in bulk again.


Note You need to log in before you can comment on or make changes to this bug.