Skip to content

Unit tests fail with Python 3.13 #79

@rajeeshknambiar

Description

@rajeeshknambiar

I'm trying to package skia-pathops in Fedora, and trying to build it in Fedora 42 (Python 3.13) consistently fails with two test cases, conic_2_quad-operations3-expected3 and arc_to_quads-operations4-expected4. The log captured below. Appreciate any pointers.

============================================================ test session starts =============================================================
platform linux -- Python 3.13.7, pytest-8.3.4, pluggy-1.5.0 -- /usr/bin/python3
cachedir: .pytest_cache
Using --randomly-seed=1072934744
rootdir: /home/rajeesh/Programs/RPMBUILD/BUILD/python-skia_pathops-0.8.0.post2-build/skia_pathops-0.8.0.post2
configfile: tox.ini
testpaths: src/python/pathops, tests
plugins: anyio-4.8.0, xdist-3.6.1, randomly-3.16.0
collected 48 items                                                                                                                           

tests/pathops_test.py::test_simplify_clockwise PASSED                                                                                  [  2%]
tests/pathops_test.py::test_reverse_path[operations15-expected15] PASSED                                                               [  4%]
tests/pathops_test.py::test_reverse_path[operations9-expected9] PASSED                                                                 [  6%]
tests/pathops_test.py::test_reverse_path[operations17-expected17] PASSED                                                               [  8%]
tests/pathops_test.py::test_reverse_path[operations8-expected8] PASSED                                                                 [ 10%]
tests/pathops_test.py::test_reverse_path[operations11-expected11] PASSED                                                               [ 12%]
tests/pathops_test.py::test_path_operation[conic_2_quad-operations3-expected3] FAILED                                                  [ 14%]
tests/pathops_test.py::test_path_operation[arc_to_quads-operations4-expected4] FAILED                                                  [ 16%]
tests/pathops_test.py::test_bits2float PASSED                                                                                          [ 18%]
tests/pathops_test.py::test_reverse_path[operations16-expected16] PASSED                                                               [ 20%]
tests/pathops_test.py::test_reverse_path[operations13-expected13] PASSED                                                               [ 22%]
tests/pathops_test.py::test_reverse_path[operations14-expected14] PASSED                                                               [ 25%]
tests/pathops_test.py::test_reverse_path[operations5-expected5] PASSED                                                                 [ 27%]
tests/pathops_test.py::test_duplicate_start_point PASSED                                                                               [ 29%]
tests/pathops_test.py::test_reverse_path[operations0-expected0] PASSED                                                                 [ 31%]
tests/pathops_test.py::test_path_operation[stroke_dash_array-operations1-expected1] PASSED                                             [ 33%]
tests/pathops_test.py::test_reverse_path[operations6-expected6] PASSED                                                                 [ 35%]
tests/pathops_test.py::test_path_operation[stroke_dash_offset-operations2-expected2] PASSED                                            [ 37%]
tests/pathops_test.py::test_reverse_path[operations1-expected1] PASSED                                                                 [ 39%]
tests/pathops_test.py::test_simplify PASSED                                                                                            [ 41%]
tests/pathops_test.py::test_reverse_path[operations4-expected4] PASSED                                                                 [ 43%]
tests/pathops_test.py::test_reverse_path[operations2-expected2] PASSED                                                                 [ 45%]
tests/pathops_test.py::test_reverse_path[operations3-expected3] PASSED                                                                 [ 47%]
tests/pathops_test.py::test_reverse_path[operations12-expected12] PASSED                                                               [ 50%]
tests/pathops_test.py::test_strip_collinear_moveTo PASSED                                                                              [ 52%]
tests/pathops_test.py::test_reverse_path[operations10-expected10] PASSED                                                               [ 54%]
tests/pathops_test.py::test_reverse_path[operations7-expected7] PASSED                                                                 [ 56%]
tests/pathops_test.py::test_path_operation[stroke_2_wide-operations0-expected0] PASSED                                                 [ 58%]
tests/pathops_test.py::test_float2bits PASSED                                                                                          [ 60%]
tests/pathops_test.py::OpBuilderTest::test_resolve PASSED                                                                              [ 62%]
tests/pathops_test.py::OpBuilderTest::test_add PASSED                                                                                  [ 64%]
tests/pathops_test.py::OpBuilderTest::test_init PASSED                                                                                 [ 66%]
tests/pathops_test.py::PathTest::test_last_implicit_lineTo PASSED                                                                      [ 68%]
tests/pathops_test.py::PathTest::test_eq_operator PASSED                                                                               [ 70%]
tests/pathops_test.py::PathTest::test_getPen PASSED                                                                                    [ 72%]
tests/pathops_test.py::PathTest::test_init PASSED                                                                                      [ 75%]
tests/pathops_test.py::PathTest::test_copy PASSED                                                                                      [ 77%]
tests/pathops_test.py::PathTest::test_qCurveTo_varargs PASSED                                                                          [ 79%]
tests/pathops_test.py::PathTest::test_pen_addComponent_missing_required_glyphSet PASSED                                                [ 81%]
tests/pathops_test.py::PathTest::test_decompose_join_quadratic_segments PASSED                                                         [ 83%]
tests/pathops_test.py::PathTest::test_decompose_join_oncurveless_quadratic_segments PASSED                                             [ 85%]
tests/pathops_test.py::PathTest::test_raise_open_contour_error PASSED                                                                  [ 87%]
tests/pathops_test.py::PathTest::test_pen_addComponent_decomposed_from_glyphSet PASSED                                                 [ 89%]
tests/pathops_test.py::PathTest::test_allow_open_contour PASSED                                                                        [ 91%]
tests/pathops_test.py::PathTest::test_transform PASSED                                                                                 [ 93%]
tests/pathops_test.py::PathTest::test_curveTo_varargs PASSED                                                                           [ 95%]
tests/pathops_test.py::PathTest::test_draw PASSED                                                                                      [ 97%]
tests/operations_test.py::test_intersection[subject_path0-clip_path0-expected0] PASSED                                                 [100%]

================================================================== FAILURES ==================================================================
__________________________________________ test_path_operation[conic_2_quad-operations3-expected3] ___________________________________________

message = 'conic_2_quad', operations = (('moveTo', (10, 10)), ('conicTo', (20, 20, 10, 30, 3)), ('convertConicsToQuads', ()))
expected = (('moveTo', ((10.0, 10.0),)), ('qCurveTo', ((14.39, 18.79), (17.5, 26.04), (17.5, 28.96), (14.39, 30.0), (10.0, 30.0))), ('endPath', ()))

    @pytest.mark.parametrize(
        "message, operations, expected",
        [
            (
                'stroke_2_wide',
                (
                    ('moveTo', (5, 5)),
                    ('lineTo', (10, 5)),
                    ('stroke', (2, 0, 0, 1)),
                ),
                (
                    ('moveTo', ((5., 4.),)),
                    ('lineTo', ((10., 4.),)),
                    ('lineTo', ((10., 6.),)),
                    ('lineTo', ((5., 6.),)),
                    ('lineTo', ((5., 4.),)),
                    ('closePath', ()),
                ),
            ),
            (
                'stroke_dash_array',
                (
                    ('moveTo', (5, 5)),
                    ('lineTo', (10, 5)),
                    ('stroke', (2, 0, 0, 1, (1, 1))),
                ),
                (
                    ('moveTo', ((5.0, 4.0),)),
                    ('lineTo', ((6.0, 4.0),)),
                    ('lineTo', ((6.0, 6.0),)),
                    ('lineTo', ((5.0, 6.0),)),
                    ('endPath', ()),
                    ('moveTo', ((7.0, 4.0),)),
                    ('lineTo', ((8.0, 4.0),)),
                    ('lineTo', ((8.0, 6.0),)),
                    ('lineTo', ((7.0, 6.0),)),
                    ('endPath', ()),
                    ('moveTo', ((9.0, 4.0),)),
                    ('lineTo', ((10.0, 4.0),)),
                    ('lineTo', ((10.0, 6.0),)),
                    ('lineTo', ((9.0, 6.0),)),
                    ('endPath', ()),
                ),
            ),
            (
                'stroke_dash_offset',
                (
                    ('moveTo', (5, 5)),
                    ('lineTo', (10, 5)),
                    ('stroke', (2, 0, 0, 1, (1, 1), 0.5)),
                ),
                (
                    ('moveTo', ((5.0, 4.0),)),
                    ('lineTo', ((5.5, 4.0),)),
                    ('lineTo', ((5.5, 6.0),)),
                    ('lineTo', ((5.0, 6.0),)),
                    ('endPath', ()),
                    ('moveTo', ((6.5, 4.0),)),
                    ('lineTo', ((7.5, 4.0),)),
                    ('lineTo', ((7.5, 6.0),)),
                    ('lineTo', ((6.5, 6.0),)),
                    ('endPath', ()),
                    ('moveTo', ((8.5, 4.0),)),
                    ('lineTo', ((9.5, 4.0),)),
                    ('lineTo', ((9.5, 6.0),)),
                    ('lineTo', ((8.5, 6.0),)),
                    ('endPath', ()),
                ),
            ),
            (
                'conic_2_quad',
                (
                    ('moveTo', (10, 10)),
                    ('conicTo', (20, 20, 10, 30, 3)),
                    ('convertConicsToQuads', ()),
                ),
                (
                    ('moveTo', ((10.0, 10.0),)),
                    ('qCurveTo', ((14.39, 18.79), (17.50, 26.04), (17.50, 28.96), (14.39, 30.00), (10.0, 30.0))),
                    ('endPath', ())
                ),
            ),
            (
                'arc_to_quads',
                (
                    ('moveTo', (7, 5)),
                    ('arcTo', (3, 1, 0, ArcSize.SMALL, Direction.CCW, 7, 2)),
                    ('convertConicsToQuads', ()),
                ),
                (
                    ('moveTo', ((7.0, 5.0),)),
                    ('qCurveTo', ((11.5, 5.0), (11.5, 2.0), (7.0, 2.0))),
                    ('endPath', ()),
                )
            )
        ]
    )
    def test_path_operation(message, operations, expected):
        path = Path()
        for op, args in operations:
            getattr(path, op)(*args)
        # round the values we get back
        rounded = []
        for verb, pts in path.segments:
            round_pts = []
            for pt in pts:
                round_pts.append(tuple(round(c, 2) for c in pt))
            rounded.append((verb, tuple(round_pts)))
>       assert tuple(rounded) == expected, message
E       AssertionError: conic_2_quad
E       assert (('moveTo', (...endPath', ())) == (('moveTo', (...endPath', ()))
E         
E         At index 1 diff: ('qCurveTo', ((10.0, 10.0), (10.0, 11.52), (10.0, 14.34), (10.0, 18.01), (10.0, 21.99), (10.0, 25.66), (10.0, 28.48), (10.0, 30.0), (10.0, 30.0))) != ('qCurveTo', ((14.39, 18.79), (17.5, 26.04), (17.5, 28.96), (14.39, 30.0), (10.0, 30.0)))
E         
E         Full diff:
E           (
E               (
E                   'moveTo',...
E         
E         ...Full output truncated (72 lines hidden), use '-vv' to show

tests/pathops_test.py:1002: AssertionError
__________________________________________ test_path_operation[arc_to_quads-operations4-expected4] ___________________________________________

message = 'arc_to_quads'
operations = (('moveTo', (7, 5)), ('arcTo', (3, 1, 0, <ArcSize.SMALL: 0>, <Direction.CCW: 1>, 7, ...)), ('convertConicsToQuads', ()))
expected = (('moveTo', ((7.0, 5.0),)), ('qCurveTo', ((11.5, 5.0), (11.5, 2.0), (7.0, 2.0))), ('endPath', ()))

    @pytest.mark.parametrize(
        "message, operations, expected",
        [
            (
                'stroke_2_wide',
                (
                    ('moveTo', (5, 5)),
                    ('lineTo', (10, 5)),
                    ('stroke', (2, 0, 0, 1)),
                ),
                (
                    ('moveTo', ((5., 4.),)),
                    ('lineTo', ((10., 4.),)),
                    ('lineTo', ((10., 6.),)),
                    ('lineTo', ((5., 6.),)),
                    ('lineTo', ((5., 4.),)),
                    ('closePath', ()),
                ),
            ),
            (
                'stroke_dash_array',
                (
                    ('moveTo', (5, 5)),
                    ('lineTo', (10, 5)),
                    ('stroke', (2, 0, 0, 1, (1, 1))),
                ),
                (
                    ('moveTo', ((5.0, 4.0),)),
                    ('lineTo', ((6.0, 4.0),)),
                    ('lineTo', ((6.0, 6.0),)),
                    ('lineTo', ((5.0, 6.0),)),
                    ('endPath', ()),
                    ('moveTo', ((7.0, 4.0),)),
                    ('lineTo', ((8.0, 4.0),)),
                    ('lineTo', ((8.0, 6.0),)),
                    ('lineTo', ((7.0, 6.0),)),
                    ('endPath', ()),
                    ('moveTo', ((9.0, 4.0),)),
                    ('lineTo', ((10.0, 4.0),)),
                    ('lineTo', ((10.0, 6.0),)),
                    ('lineTo', ((9.0, 6.0),)),
                    ('endPath', ()),
                ),
            ),
            (
                'stroke_dash_offset',
                (
                    ('moveTo', (5, 5)),
                    ('lineTo', (10, 5)),
                    ('stroke', (2, 0, 0, 1, (1, 1), 0.5)),
                ),
                (
                    ('moveTo', ((5.0, 4.0),)),
                    ('lineTo', ((5.5, 4.0),)),
                    ('lineTo', ((5.5, 6.0),)),
                    ('lineTo', ((5.0, 6.0),)),
                    ('endPath', ()),
                    ('moveTo', ((6.5, 4.0),)),
                    ('lineTo', ((7.5, 4.0),)),
                    ('lineTo', ((7.5, 6.0),)),
                    ('lineTo', ((6.5, 6.0),)),
                    ('endPath', ()),
                    ('moveTo', ((8.5, 4.0),)),
                    ('lineTo', ((9.5, 4.0),)),
                    ('lineTo', ((9.5, 6.0),)),
                    ('lineTo', ((8.5, 6.0),)),
                    ('endPath', ()),
                ),
            ),
            (
                'conic_2_quad',
                (
                    ('moveTo', (10, 10)),
                    ('conicTo', (20, 20, 10, 30, 3)),
                    ('convertConicsToQuads', ()),
                ),
                (
                    ('moveTo', ((10.0, 10.0),)),
                    ('qCurveTo', ((14.39, 18.79), (17.50, 26.04), (17.50, 28.96), (14.39, 30.00), (10.0, 30.0))),
                    ('endPath', ())
                ),
            ),
            (
                'arc_to_quads',
                (
                    ('moveTo', (7, 5)),
                    ('arcTo', (3, 1, 0, ArcSize.SMALL, Direction.CCW, 7, 2)),
                    ('convertConicsToQuads', ()),
                ),
                (
                    ('moveTo', ((7.0, 5.0),)),
                    ('qCurveTo', ((11.5, 5.0), (11.5, 2.0), (7.0, 2.0))),
                    ('endPath', ()),
                )
            )
        ]
    )
    def test_path_operation(message, operations, expected):
        path = Path()
        for op, args in operations:
            getattr(path, op)(*args)
        # round the values we get back
        rounded = []
        for verb, pts in path.segments:
            round_pts = []
            for pt in pts:
                round_pts.append(tuple(round(c, 2) for c in pt))
            rounded.append((verb, tuple(round_pts)))
>       assert tuple(rounded) == expected, message
E       AssertionError: arc_to_quads
E       assert (('moveTo', (...endPath', ())) == (('moveTo', (...endPath', ()))
E         
E         At index 1 diff: ('qCurveTo', ((7.0, 5.0), (8.32, 4.56), (10.18, 3.94), (11.5, 3.5), (11.5, 3.5), (10.18, 3.06), (8.32, 2.44), (7.0, 2.0), (7.0, 2.0))) != ('qCurveTo', ((11.5, 5.0), (11.5, 2.0), (7.0, 2.0)))
E         
E         Full diff:
E           (
E               (
E                   'moveTo',...
E         
E         ...Full output truncated (56 lines hidden), use '-vv' to show

tests/pathops_test.py:1002: AssertionError
========================================================== short test summary info ===========================================================
FAILED tests/pathops_test.py::test_path_operation[conic_2_quad-operations3-expected3] - AssertionError: conic_2_quad
FAILED tests/pathops_test.py::test_path_operation[arc_to_quads-operations4-expected4] - AssertionError: arc_to_quads
======================================================== 2 failed, 46 passed in 0.26s ========================================================

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions