question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tests do not pass with Cairo development snapshots

See original GitHub issue

I’m trying to get an Arch Linux PKGBUILD to build weasyprint. The unittests won’t pass though, with the following error:

=================================== FAILURES ===================================
______________________________ test_document_info ______________________________

    @assert_no_logs
    @requires('cairo', (1, 15, 4))
    def test_document_info():
        fileobj = io.BytesIO()
        FakeHTML(string='''
          <meta name=author content="I Me &amp; Myself">
          <title>Test document</title>
          <h1>Another title</h1>
          <meta name=generator content="Human after all">
          <meta name=keywords content="html ,\tcss,
                                       pdf,css">
          <meta name=description content="Blah… ">
          <meta name=dcterms.created content=2011-04-21T23:00:00Z>
          <meta name=dcterms.modified content=2013-07-21T23:46+01:00>
        ''').write_pdf(target=fileobj)
        info = pdf.PDFFile(fileobj).info
        assert info.get_value('Author', '(.*)') == b'(I Me & Myself)'
        assert info.get_value('Title', '(.*)') == b'(Test document)'
        assert info.get_value('Creator', '(.*)') == (
            b'<FEFF00480075006D0061006E00A00061006600740065007200A00061006C006C>')
        assert info.get_value('Keywords', '(.*)') == b'(html, css, pdf)'
        assert info.get_value('Subject', '(.*)') == (
            b'<FEFF0042006C0061006820260020>')
>       assert info.get_value('CreationDate', '(.*)') == b"(20110421230000+00'00)"
E       assert b"(20110421230000+00'00')" == b"(20110421230000+00'00)"
E         At index 21 diff: b"'" != b')'
E         Use -v to get the full diff

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_pdf.py:654: AssertionError
------------------------------ Captured log call -------------------------------
INFO     weasyprint.progress:__init__.py:103 Step 1 - Fetching and parsing HTML - HTML string
INFO     weasyprint.progress:__init__.py:64 Step 3 - Applying CSS
INFO     weasyprint.progress:document.py:380 Step 4 - Creating formatting structure
INFO     weasyprint.progress:pages.py:794 Step 5 - Creating layout - Page 1
INFO     weasyprint.progress:document.py:640 Step 6 - Drawing
INFO     weasyprint.progress:document.py:658 Step 7 - Adding PDF metadata
______________________________ test_float_inline _______________________________

    @assert_no_logs
    def test_float_inline():
>       assert_pixels('float_inline', 15, 5, '''
            rBBBGG_____aaaa
            BBBBGG_____aaaa
            BBBB_______aaaa
            BBBB_______aaaa
            _______________
        ''', '''
          <style>
            @font-face {src: url(AHEM____.TTF); font-family: ahem}
            @page { size: 15px 5px; background: white }
            body { font-family: ahem; font-size: 2px; line-height: 1; color: lime }
          </style>
          <div>
            <img style="float: left" src="pattern.png">
            <img style="float: right" src="blue.jpg">
            <span>a</span>
          </div>
        ''')

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/test_float.py:55: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/__init__.py:57: in assert_pixels
    assert_pixels_equal(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'float_inline', width = 15, height = 5
raw = b'\x00\x00\xff\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\xff\xff\xff\xff\xff...ff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
expected_raw = b'\x00\x00\xff\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\xff\xff\xff\xff\xff...ff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
tolerance = 0

    def assert_pixels_equal(name, width, height, raw, expected_raw, tolerance=0):
        """Take 2 matrices of pixels and assert that they are the same."""
        if raw != expected_raw:  # pragma: no cover
            for i, (value, expected) in enumerate(zip(raw, expected_raw)):
                if abs(value - expected) > tolerance:
                    write_png(name, raw, width, height)
                    write_png(name + '.expected', expected_raw,
                              width, height)
                    pixel_n = i // 4
                    x = pixel_n // width
                    y = pixel_n % width
                    i % 4
                    pixel = tuple(list(raw[i:i + 4]))
                    expected_pixel = tuple(list(
                        expected_raw[i:i + 4]))
>                   assert 0, (
                        'Pixel (%i, %i) in %s: expected rgba%s, got rgba%s'
                        % (x, y, name, expected_pixel, pixel))
E                   AssertionError: Pixel (1, 4) in float_inline: expected rgba(0, 255, 0, 255), got rgba(127, 255, 127, 255)

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/__init__.py:160: AssertionError
------------------------------ Captured log call -------------------------------
INFO     weasyprint.progress:__init__.py:103 Step 1 - Fetching and parsing HTML - HTML string
INFO     weasyprint.progress:__init__.py:349 Step 2 - Fetching and parsing CSS - CSS string
INFO     weasyprint.progress:__init__.py:64 Step 3 - Applying CSS
INFO     weasyprint.progress:document.py:380 Step 4 - Creating formatting structure
INFO     weasyprint.progress:pages.py:794 Step 5 - Creating layout - Page 1
INFO     weasyprint.progress:document.py:775 Step 6 - Drawing
____________________________ test_float_inline_rtl _____________________________

    @assert_no_logs
    def test_float_inline_rtl():
>       assert_pixels('float_inline_rtl', 15, 5, '''
            rBBB_____GGaaaa
            BBBB_____GGaaaa
            BBBB_______aaaa
            BBBB_______aaaa
            _______________
        ''', '''
          <style>
            @font-face {src: url(AHEM____.TTF); font-family: ahem}
            @page { size: 15px 5px; background: white }
            body { font-family: ahem; font-size: 2px; line-height: 1; color: lime }
          </style>
          <div style="direction: rtl">
            <img style="float: left" src="pattern.png">
            <img style="float: right" src="blue.jpg">
            <span>a</span>
          </div>
        ''')

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/test_float.py:77: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/__init__.py:57: in assert_pixels
    assert_pixels_equal(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'float_inline_rtl', width = 15, height = 5
raw = b'\x00\x00\xff\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff...ff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
expected_raw = b'\x00\x00\xff\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff...ff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
tolerance = 0

    def assert_pixels_equal(name, width, height, raw, expected_raw, tolerance=0):
        """Take 2 matrices of pixels and assert that they are the same."""
        if raw != expected_raw:  # pragma: no cover
            for i, (value, expected) in enumerate(zip(raw, expected_raw)):
                if abs(value - expected) > tolerance:
                    write_png(name, raw, width, height)
                    write_png(name + '.expected', expected_raw,
                              width, height)
                    pixel_n = i // 4
                    x = pixel_n // width
                    y = pixel_n % width
                    i % 4
                    pixel = tuple(list(raw[i:i + 4]))
                    expected_pixel = tuple(list(
                        expected_raw[i:i + 4]))
>                   assert 0, (
                        'Pixel (%i, %i) in %s: expected rgba%s, got rgba%s'
                        % (x, y, name, expected_pixel, pixel))
E                   AssertionError: Pixel (1, 9) in float_inline_rtl: expected rgba(0, 255, 0, 255), got rgba(127, 255, 127, 255)

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/__init__.py:160: AssertionError
------------------------------ Captured log call -------------------------------
INFO     weasyprint.progress:__init__.py:103 Step 1 - Fetching and parsing HTML - HTML string
INFO     weasyprint.progress:__init__.py:349 Step 2 - Fetching and parsing CSS - CSS string
INFO     weasyprint.progress:__init__.py:64 Step 3 - Applying CSS
INFO     weasyprint.progress:document.py:380 Step 4 - Creating formatting structure
INFO     weasyprint.progress:pages.py:794 Step 5 - Creating layout - Page 1
INFO     weasyprint.progress:document.py:775 Step 6 - Drawing
___________________________ test_float_inline_block ____________________________

    @assert_no_logs
    def test_float_inline_block():
>       assert_pixels('float_inline_block', 15, 5, '''
            rBBBGG_____aaaa
            BBBBGG_____aaaa
            BBBB_______aaaa
            BBBB_______aaaa
            _______________
        ''', '''
          <style>
            @font-face {src: url(AHEM____.TTF); font-family: ahem}
            @page { size: 15px 5px; background: white }
            body { font-family: ahem; font-size: 2px; line-height: 1; color: lime }
          </style>
          <div>
            <img style="float: left" src="pattern.png">
            <img style="float: right" src="blue.jpg">
            <span style="display: inline-block">a</span>
          </div>
        ''')

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/test_float.py:99: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/__init__.py:57: in assert_pixels
    assert_pixels_equal(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'float_inline_block', width = 15, height = 5
raw = b'\x00\x00\xff\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\xff\xff\xff\xff\xff...ff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
expected_raw = b'\x00\x00\xff\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\xff\xff\xff\xff\xff...ff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
tolerance = 0

    def assert_pixels_equal(name, width, height, raw, expected_raw, tolerance=0):
        """Take 2 matrices of pixels and assert that they are the same."""
        if raw != expected_raw:  # pragma: no cover
            for i, (value, expected) in enumerate(zip(raw, expected_raw)):
                if abs(value - expected) > tolerance:
                    write_png(name, raw, width, height)
                    write_png(name + '.expected', expected_raw,
                              width, height)
                    pixel_n = i // 4
                    x = pixel_n // width
                    y = pixel_n % width
                    i % 4
                    pixel = tuple(list(raw[i:i + 4]))
                    expected_pixel = tuple(list(
                        expected_raw[i:i + 4]))
>                   assert 0, (
                        'Pixel (%i, %i) in %s: expected rgba%s, got rgba%s'
                        % (x, y, name, expected_pixel, pixel))
E                   AssertionError: Pixel (1, 4) in float_inline_block: expected rgba(0, 255, 0, 255), got rgba(127, 255, 127, 255)

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/__init__.py:160: AssertionError
------------------------------ Captured log call -------------------------------
INFO     weasyprint.progress:__init__.py:103 Step 1 - Fetching and parsing HTML - HTML string
INFO     weasyprint.progress:__init__.py:349 Step 2 - Fetching and parsing CSS - CSS string
INFO     weasyprint.progress:__init__.py:64 Step 3 - Applying CSS
INFO     weasyprint.progress:document.py:380 Step 4 - Creating formatting structure
INFO     weasyprint.progress:pages.py:794 Step 5 - Creating layout - Page 1
INFO     weasyprint.progress:document.py:775 Step 6 - Drawing
_________________________ test_float_inline_block_rtl __________________________

    @assert_no_logs
    def test_float_inline_block_rtl():
>       assert_pixels('float_inline_block_rtl', 15, 5, '''
            rBBB_____GGaaaa
            BBBB_____GGaaaa
            BBBB_______aaaa
            BBBB_______aaaa
            _______________
        ''', '''
          <style>
            @font-face {src: url(AHEM____.TTF); font-family: ahem}
            @page { size: 15px 5px; background: white }
            body { font-family: ahem; font-size: 2px; line-height: 1; color: lime }
          </style>
          <div style="direction: rtl">
            <img style="float: left" src="pattern.png">
            <img style="float: right" src="blue.jpg">
            <span style="display: inline-block">a</span>
          </div>
        ''')

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/test_float.py:121: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/__init__.py:57: in assert_pixels
    assert_pixels_equal(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'float_inline_block_rtl', width = 15, height = 5
raw = b'\x00\x00\xff\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff...ff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
expected_raw = b'\x00\x00\xff\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff...ff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
tolerance = 0

    def assert_pixels_equal(name, width, height, raw, expected_raw, tolerance=0):
        """Take 2 matrices of pixels and assert that they are the same."""
        if raw != expected_raw:  # pragma: no cover
            for i, (value, expected) in enumerate(zip(raw, expected_raw)):
                if abs(value - expected) > tolerance:
                    write_png(name, raw, width, height)
                    write_png(name + '.expected', expected_raw,
                              width, height)
                    pixel_n = i // 4
                    x = pixel_n // width
                    y = pixel_n % width
                    i % 4
                    pixel = tuple(list(raw[i:i + 4]))
                    expected_pixel = tuple(list(
                        expected_raw[i:i + 4]))
>                   assert 0, (
                        'Pixel (%i, %i) in %s: expected rgba%s, got rgba%s'
                        % (x, y, name, expected_pixel, pixel))
E                   AssertionError: Pixel (1, 9) in float_inline_block_rtl: expected rgba(0, 255, 0, 255), got rgba(127, 255, 127, 255)

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/__init__.py:160: AssertionError
------------------------------ Captured log call -------------------------------
INFO     weasyprint.progress:__init__.py:103 Step 1 - Fetching and parsing HTML - HTML string
INFO     weasyprint.progress:__init__.py:349 Step 2 - Fetching and parsing CSS - CSS string
INFO     weasyprint.progress:__init__.py:64 Step 3 - Applying CSS
INFO     weasyprint.progress:document.py:380 Step 4 - Creating formatting structure
INFO     weasyprint.progress:pages.py:794 Step 5 - Creating layout - Page 1
INFO     weasyprint.progress:document.py:775 Step 6 - Drawing
_______________________________ test_float_table _______________________________

    @assert_no_logs
    def test_float_table():
>       assert_pixels('float_table', 15, 5, '''
            rBBBGG_____aaaa
            BBBBGG_____aaaa
            BBBB_______aaaa
            BBBB_______aaaa
            _______________
        ''', '''
          <style>
            @font-face {src: url(AHEM____.TTF); font-family: ahem}
            @page { size: 15px 5px; background: white }
            body { font-family: ahem; font-size: 2px; line-height: 1; color: lime }
          </style>
          <div>
            <img style="float: left" src="pattern.png">
            <img style="float: right" src="blue.jpg">
            <table><tbody><tr><td>a</td></tr></tbody></table>
          </div>
        ''')

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/test_float.py:143: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/__init__.py:57: in assert_pixels
    assert_pixels_equal(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'float_table', width = 15, height = 5
raw = b'\x00\x00\xff\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\xff\xff\xff\xff\xff...ff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
expected_raw = b'\x00\x00\xff\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\xff\xff\xff\xff\xff...ff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
tolerance = 0

    def assert_pixels_equal(name, width, height, raw, expected_raw, tolerance=0):
        """Take 2 matrices of pixels and assert that they are the same."""
        if raw != expected_raw:  # pragma: no cover
            for i, (value, expected) in enumerate(zip(raw, expected_raw)):
                if abs(value - expected) > tolerance:
                    write_png(name, raw, width, height)
                    write_png(name + '.expected', expected_raw,
                              width, height)
                    pixel_n = i // 4
                    x = pixel_n // width
                    y = pixel_n % width
                    i % 4
                    pixel = tuple(list(raw[i:i + 4]))
                    expected_pixel = tuple(list(
                        expected_raw[i:i + 4]))
>                   assert 0, (
                        'Pixel (%i, %i) in %s: expected rgba%s, got rgba%s'
                        % (x, y, name, expected_pixel, pixel))
E                   AssertionError: Pixel (1, 4) in float_table: expected rgba(0, 255, 0, 255), got rgba(127, 255, 127, 255)

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/__init__.py:160: AssertionError
------------------------------ Captured log call -------------------------------
INFO     weasyprint.progress:__init__.py:103 Step 1 - Fetching and parsing HTML - HTML string
INFO     weasyprint.progress:__init__.py:349 Step 2 - Fetching and parsing CSS - CSS string
INFO     weasyprint.progress:__init__.py:64 Step 3 - Applying CSS
INFO     weasyprint.progress:document.py:380 Step 4 - Creating formatting structure
INFO     weasyprint.progress:pages.py:794 Step 5 - Creating layout - Page 1
INFO     weasyprint.progress:document.py:775 Step 6 - Drawing
_____________________________ test_float_table_rtl _____________________________

    @assert_no_logs
    def test_float_table_rtl():
>       assert_pixels('float_table_rtl', 15, 5, '''
            rBBB_____GGaaaa
            BBBB_____GGaaaa
            BBBB_______aaaa
            BBBB_______aaaa
            _______________
        ''', '''
          <style>
            @font-face {src: url(AHEM____.TTF); font-family: ahem}
            @page { size: 15px 5px; background: white }
            body { font-family: ahem; font-size: 2px; line-height: 1; color: lime }
          </style>
          <div style="direction: rtl">
            <img style="float: left" src="pattern.png">
            <img style="float: right" src="blue.jpg">
            <table><tbody><tr><td>a</td></tr></tbody></table>
          </div>
        ''')

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/test_float.py:165: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/__init__.py:57: in assert_pixels
    assert_pixels_equal(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'float_table_rtl', width = 15, height = 5
raw = b'\x00\x00\xff\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff...ff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
expected_raw = b'\x00\x00\xff\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff...ff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
tolerance = 0

    def assert_pixels_equal(name, width, height, raw, expected_raw, tolerance=0):
        """Take 2 matrices of pixels and assert that they are the same."""
        if raw != expected_raw:  # pragma: no cover
            for i, (value, expected) in enumerate(zip(raw, expected_raw)):
                if abs(value - expected) > tolerance:
                    write_png(name, raw, width, height)
                    write_png(name + '.expected', expected_raw,
                              width, height)
                    pixel_n = i // 4
                    x = pixel_n // width
                    y = pixel_n % width
                    i % 4
                    pixel = tuple(list(raw[i:i + 4]))
                    expected_pixel = tuple(list(
                        expected_raw[i:i + 4]))
>                   assert 0, (
                        'Pixel (%i, %i) in %s: expected rgba%s, got rgba%s'
                        % (x, y, name, expected_pixel, pixel))
E                   AssertionError: Pixel (1, 9) in float_table_rtl: expected rgba(0, 255, 0, 255), got rgba(127, 255, 127, 255)

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/__init__.py:160: AssertionError
------------------------------ Captured log call -------------------------------
INFO     weasyprint.progress:__init__.py:103 Step 1 - Fetching and parsing HTML - HTML string
INFO     weasyprint.progress:__init__.py:349 Step 2 - Fetching and parsing CSS - CSS string
INFO     weasyprint.progress:__init__.py:64 Step 3 - Applying CSS
INFO     weasyprint.progress:document.py:380 Step 4 - Creating formatting structure
INFO     weasyprint.progress:pages.py:794 Step 5 - Creating layout - Page 1
INFO     weasyprint.progress:document.py:775 Step 6 - Drawing
___________________________ test_float_inline_table ____________________________

    @assert_no_logs
    def test_float_inline_table():
>       assert_pixels('float_inline_table', 15, 5, '''
            rBBBGG_____aaaa
            BBBBGG_____aaaa
            BBBB_______aaaa
            BBBB_______aaaa
            _______________
        ''', '''
          <style>
            @font-face {src: url(AHEM____.TTF); font-family: ahem}
            @page { size: 15px 5px; background: white }
            table { display: inline-table }
            body { font-family: ahem; font-size: 2px; line-height: 1; color: lime }
          </style>
          <div>
            <img style="float: left" src="pattern.png">
            <img style="float: right" src="blue.jpg">
            <table><tbody><tr><td>a</td></tr></tbody></table>
          </div>
        ''')

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/test_float.py:187: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/__init__.py:57: in assert_pixels
    assert_pixels_equal(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'float_inline_table', width = 15, height = 5
raw = b'\x00\x00\xff\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\xff\xff\xff\xff\xff...ff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
expected_raw = b'\x00\x00\xff\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\xff\xff\xff\xff\xff...ff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
tolerance = 0

    def assert_pixels_equal(name, width, height, raw, expected_raw, tolerance=0):
        """Take 2 matrices of pixels and assert that they are the same."""
        if raw != expected_raw:  # pragma: no cover
            for i, (value, expected) in enumerate(zip(raw, expected_raw)):
                if abs(value - expected) > tolerance:
                    write_png(name, raw, width, height)
                    write_png(name + '.expected', expected_raw,
                              width, height)
                    pixel_n = i // 4
                    x = pixel_n // width
                    y = pixel_n % width
                    i % 4
                    pixel = tuple(list(raw[i:i + 4]))
                    expected_pixel = tuple(list(
                        expected_raw[i:i + 4]))
>                   assert 0, (
                        'Pixel (%i, %i) in %s: expected rgba%s, got rgba%s'
                        % (x, y, name, expected_pixel, pixel))
E                   AssertionError: Pixel (1, 4) in float_inline_table: expected rgba(0, 255, 0, 255), got rgba(127, 255, 127, 255)

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/__init__.py:160: AssertionError
------------------------------ Captured log call -------------------------------
INFO     weasyprint.progress:__init__.py:103 Step 1 - Fetching and parsing HTML - HTML string
INFO     weasyprint.progress:__init__.py:349 Step 2 - Fetching and parsing CSS - CSS string
INFO     weasyprint.progress:__init__.py:64 Step 3 - Applying CSS
INFO     weasyprint.progress:document.py:380 Step 4 - Creating formatting structure
INFO     weasyprint.progress:pages.py:794 Step 5 - Creating layout - Page 1
INFO     weasyprint.progress:document.py:775 Step 6 - Drawing
_________________________ test_float_inline_table_rtl __________________________

    @assert_no_logs
    def test_float_inline_table_rtl():
>       assert_pixels('float_inline_table_rtl', 15, 5, '''
            rBBB_____GGaaaa
            BBBB_____GGaaaa
            BBBB_______aaaa
            BBBB_______aaaa
            _______________
        ''', '''
          <style>
            @font-face {src: url(AHEM____.TTF); font-family: ahem}
            @page { size: 15px 5px; background: white }
            table { display: inline-table }
            body { font-family: ahem; font-size: 2px; line-height: 1; color: lime }
          </style>
          <div style="direction: rtl">
            <img style="float: left" src="pattern.png">
            <img style="float: right" src="blue.jpg">
            <table><tbody><tr><td>a</td></tr></tbody></table>
          </div>
        ''')

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/test_float.py:210: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/__init__.py:57: in assert_pixels
    assert_pixels_equal(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'float_inline_table_rtl', width = 15, height = 5
raw = b'\x00\x00\xff\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff...ff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
expected_raw = b'\x00\x00\xff\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff...ff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
tolerance = 0

    def assert_pixels_equal(name, width, height, raw, expected_raw, tolerance=0):
        """Take 2 matrices of pixels and assert that they are the same."""
        if raw != expected_raw:  # pragma: no cover
            for i, (value, expected) in enumerate(zip(raw, expected_raw)):
                if abs(value - expected) > tolerance:
                    write_png(name, raw, width, height)
                    write_png(name + '.expected', expected_raw,
                              width, height)
                    pixel_n = i // 4
                    x = pixel_n // width
                    y = pixel_n % width
                    i % 4
                    pixel = tuple(list(raw[i:i + 4]))
                    expected_pixel = tuple(list(
                        expected_raw[i:i + 4]))
>                   assert 0, (
                        'Pixel (%i, %i) in %s: expected rgba%s, got rgba%s'
                        % (x, y, name, expected_pixel, pixel))
E                   AssertionError: Pixel (1, 9) in float_inline_table_rtl: expected rgba(0, 255, 0, 255), got rgba(127, 255, 127, 255)

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/__init__.py:160: AssertionError
------------------------------ Captured log call -------------------------------
INFO     weasyprint.progress:__init__.py:103 Step 1 - Fetching and parsing HTML - HTML string
INFO     weasyprint.progress:__init__.py:349 Step 2 - Fetching and parsing CSS - CSS string
INFO     weasyprint.progress:__init__.py:64 Step 3 - Applying CSS
INFO     weasyprint.progress:document.py:380 Step 4 - Creating formatting structure
INFO     weasyprint.progress:pages.py:794 Step 5 - Creating layout - Page 1
INFO     weasyprint.progress:document.py:775 Step 6 - Drawing
___________________________ test_text_overflow_clip ____________________________

    def test_text_overflow_clip():
>       assert_pixels('text_overflow', 9, 7, '''
            _________
            _RRRRRRR_
            _RRRRRRR_
            _________
            _RR__RRR_
            _RR__RRR_
            _________
        ''', '''
          <style>
            @font-face {src: url(AHEM____.TTF); font-family: ahem}
            @page {
              size: 9px 7px;
              background: white;
            }
            body {
              color: red;
              font-family: ahem;
              font-size: 2px;
            }
            div {
              line-height: 1;
              margin: 1px;
              overflow: hidden;
              width: 3.5em;
            }
          </style>
          <div>abcde</div>
          <div style="white-space: nowrap">a bcde</div>''')

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/test_text.py:13: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/__init__.py:57: in assert_pixels
    assert_pixels_equal(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'text_overflow', width = 9, height = 7
raw = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff...ff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
expected_raw = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff...ff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
tolerance = 0

    def assert_pixels_equal(name, width, height, raw, expected_raw, tolerance=0):
        """Take 2 matrices of pixels and assert that they are the same."""
        if raw != expected_raw:  # pragma: no cover
            for i, (value, expected) in enumerate(zip(raw, expected_raw)):
                if abs(value - expected) > tolerance:
                    write_png(name, raw, width, height)
                    write_png(name + '.expected', expected_raw,
                              width, height)
                    pixel_n = i // 4
                    x = pixel_n // width
                    y = pixel_n % width
                    i % 4
                    pixel = tuple(list(raw[i:i + 4]))
                    expected_pixel = tuple(list(
                        expected_raw[i:i + 4]))
>                   assert 0, (
                        'Pixel (%i, %i) in %s: expected rgba%s, got rgba%s'
                        % (x, y, name, expected_pixel, pixel))
E                   AssertionError: Pixel (2, 1) in text_overflow: expected rgba(0, 0, 255, 255), got rgba(127, 127, 255, 255)

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/__init__.py:160: AssertionError
------------------------------ Captured log call -------------------------------
INFO     weasyprint.progress:__init__.py:103 Step 1 - Fetching and parsing HTML - HTML string
INFO     weasyprint.progress:__init__.py:349 Step 2 - Fetching and parsing CSS - CSS string
INFO     weasyprint.progress:__init__.py:64 Step 3 - Applying CSS
INFO     weasyprint.progress:document.py:380 Step 4 - Creating formatting structure
INFO     weasyprint.progress:pages.py:794 Step 5 - Creating layout - Page 1
INFO     weasyprint.progress:document.py:775 Step 6 - Drawing
_________________________ test_text_overflow_ellipsis __________________________

    def test_text_overflow_ellipsis():
>       assert_pixels('text_overflow', 9, 16, '''
            _________
            _RRRRRR__
            _RRRRRR__
            _________
            _RR__RR__
            _RR__RR__
            _________
            _RRRRRR__
            _RRRRRR__
            _________
            _RRRRRRR_
            _RRRRRRR_
            _________
            _RRRRRRR_
            _RRRRRRR_
            _________
        ''', '''
          <style>
            @font-face {src: url(AHEM____.TTF); font-family: ahem}
            @page {
              background: white;
              size: 9px 16px;
            }
            body {
              color: red;
              font-family: ahem;
              font-size: 2px;
            }
            div {
              line-height: 1;
              margin: 1px;
              overflow: hidden;
              text-overflow: ellipsis;
              width: 3.5em;
            }
            div div {
              margin: 0;
            }
          </style>
          <div>abcde</div>
          <div style="white-space: nowrap">a bcde</div>
          <div><span>a<span>b</span>cd</span>e</div>
          <div><div style="text-overflow: clip">abcde</div></div>
          <div><div style="overflow: visible">abcde</div></div>
    ''')

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/test_text.py:45: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/__init__.py:57: in assert_pixels
    assert_pixels_equal(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'text_overflow', width = 9, height = 16
raw = b'\xff\xff\xff\xff\x7f\x7f\xff\xff\x7f\x7f\xff\xff\x7f\x7f\xff\xff\x7f\x7f\xff\xff\x7f\x7f\xff\xff\x7f\x7f\xff\xff\xff...ff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
expected_raw = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff...ff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
tolerance = 0

    def assert_pixels_equal(name, width, height, raw, expected_raw, tolerance=0):
        """Take 2 matrices of pixels and assert that they are the same."""
        if raw != expected_raw:  # pragma: no cover
            for i, (value, expected) in enumerate(zip(raw, expected_raw)):
                if abs(value - expected) > tolerance:
                    write_png(name, raw, width, height)
                    write_png(name + '.expected', expected_raw,
                              width, height)
                    pixel_n = i // 4
                    x = pixel_n // width
                    y = pixel_n % width
                    i % 4
                    pixel = tuple(list(raw[i:i + 4]))
                    expected_pixel = tuple(list(
                        expected_raw[i:i + 4]))
>                   assert 0, (
                        'Pixel (%i, %i) in %s: expected rgba%s, got rgba%s'
                        % (x, y, name, expected_pixel, pixel))
E                   AssertionError: Pixel (0, 1) in text_overflow: expected rgba(255, 255, 255, 255), got rgba(127, 127, 255, 255)

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/__init__.py:160: AssertionError
------------------------------ Captured log call -------------------------------
INFO     weasyprint.progress:__init__.py:103 Step 1 - Fetching and parsing HTML - HTML string
INFO     weasyprint.progress:__init__.py:349 Step 2 - Fetching and parsing CSS - CSS string
INFO     weasyprint.progress:__init__.py:64 Step 3 - Applying CSS
INFO     weasyprint.progress:document.py:380 Step 4 - Creating formatting structure
INFO     weasyprint.progress:pages.py:794 Step 5 - Creating layout - Page 1
INFO     weasyprint.progress:document.py:775 Step 6 - Drawing
___________________ test_text_align_rtl_trailing_whitespace ____________________

    def test_text_align_rtl_trailing_whitespace():
        # Test text alignment for rtl text with trailing space.
        # Test regression: https://github.com/Kozea/WeasyPrint/issues/1111
>       assert_pixels('text_overflow', 9, 9, '''
            _________
            _rrrrBBB_
            _________
            _rrrrBBB_
            _________
            _BBBrrrr_
            _________
            _BBBrrrr_
            _________
        ''', '''
          <style>
            @font-face {src: url(AHEM____.TTF); font-family: ahem}
            @page { background: white; size: 9px }
            body { font-family: ahem; color: blue; font-size: 1px }
            p { background: red; line-height: 1; width: 7em; margin: 1em }
          </style>
          <!-- &#8207 forces Unicode RTL direction for the following chars -->
          <p style="direction: rtl"> abc </p>
          <p style="direction: rtl"> &#8207;abc </p>
          <p style="direction: ltr"> abc </p>
          <p style="direction: ltr"> &#8207;abc </p>
        ''')

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/test_text.py:96: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/__init__.py:57: in assert_pixels
    assert_pixels_equal(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'text_overflow', width = 9, height = 9
raw = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x7f\x7f\xff\xff\x7f\x7f\xff\xff...ff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
expected_raw = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff...ff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
tolerance = 0

    def assert_pixels_equal(name, width, height, raw, expected_raw, tolerance=0):
        """Take 2 matrices of pixels and assert that they are the same."""
        if raw != expected_raw:  # pragma: no cover
            for i, (value, expected) in enumerate(zip(raw, expected_raw)):
                if abs(value - expected) > tolerance:
                    write_png(name, raw, width, height)
                    write_png(name + '.expected', expected_raw,
                              width, height)
                    pixel_n = i // 4
                    x = pixel_n // width
                    y = pixel_n % width
                    i % 4
                    pixel = tuple(list(raw[i:i + 4]))
                    expected_pixel = tuple(list(
                        expected_raw[i:i + 4]))
>                   assert 0, (
                        'Pixel (%i, %i) in %s: expected rgba%s, got rgba%s'
                        % (x, y, name, expected_pixel, pixel))
E                   AssertionError: Pixel (0, 5) in text_overflow: expected rgba(255, 255, 255, 255), got rgba(127, 127, 255, 255)

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/__init__.py:160: AssertionError
------------------------------ Captured log call -------------------------------
INFO     weasyprint.progress:__init__.py:103 Step 1 - Fetching and parsing HTML - HTML string
INFO     weasyprint.progress:__init__.py:349 Step 2 - Fetching and parsing CSS - CSS string
INFO     weasyprint.progress:__init__.py:64 Step 3 - Applying CSS
INFO     weasyprint.progress:document.py:380 Step 4 - Creating formatting structure
INFO     weasyprint.progress:pages.py:794 Step 5 - Creating layout - Page 1
INFO     weasyprint.progress:document.py:775 Step 6 - Drawing
__________________________ test_table_vertical_align ___________________________

    @assert_no_logs
    @requires('cairo', (1, 12, 0))
    def test_table_vertical_align():
>       assert_pixels('table_vertical_align', 28, 10, '''
            rrrrrrrrrrrrrrrrrrrrrrrrrrrr
            rBBBBBBBBBBBBBBBBBBBBBBBBBBr
            rBrBB_BB_BB_BB_BBrrBBrrBB_Br
            rBrBB_BB_BBrBBrBBrrBBrrBBrBr
            rB_BBrBB_BBrBBrBBrrBBrrBBrBr
            rB_BBrBB_BB_BB_BBrrBBrrBB_Br
            rB_BB_BBrBB_BB_BB__BB__BB_Br
            rB_BB_BBrBB_BB_BB__BB__BB_Br
            rBBBBBBBBBBBBBBBBBBBBBBBBBBr
            rrrrrrrrrrrrrrrrrrrrrrrrrrrr
        ''', '''
          <style>
            @font-face { src: url(AHEM____.TTF); font-family: ahem }
            @page { size: 28px 10px }
            html { background: #fff; font-size: 1px; color: red }
            body { margin: 0; width: 28px; height: 10px }
            td {
              width: 1em;
              padding: 0 !important;
              border: 1px solid blue;
              line-height: 1em;
              font-family: ahem;
            }
          </style>
          <table style="border: 1px solid red; border-spacing: 0">
            <tr>
              <!-- Test vertical-align: top, auto height -->
              <td style="vertical-align: top">o o</td>
    
              <!-- Test vertical-align: middle, auto height -->
              <td style="vertical-align: middle">o o</td>
    
              <!-- Test vertical-align: bottom, fixed useless height -->
              <td style="vertical-align: bottom; height: 2em">o o</td>
    
              <!-- Test default vertical-align value (baseline),
                   fixed useless height -->
              <td style="height: 5em">o o</td>
    
              <!-- Test vertical-align: baseline with baseline set by next cell,
                   auto height -->
              <td style="vertical-align: baseline">o o</td>
    
              <!-- Set baseline height to 2px, auto height -->
              <td style="vertical-align: baseline; font-size: 2em">o o</td>
    
              <!-- Test padding-bottom, fixed useless height,
                   set the height of the cells to 2 lines * 2em + 2px = 6px -->
              <td style="vertical-align: baseline; height: 1em;
                         font-size: 2em; padding-bottom: 2px !important">
                o o
              </td>
    
              <!-- Test padding-top, auto height -->
              <td style="vertical-align: top; padding-top: 1em !important">
                o o
              </td>
            </tr>
          </table>
        ''')  # noqa

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_layout/test_table.py:1868: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/__init__.py:57: in assert_pixels
    assert_pixels_equal(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'table_vertical_align', width = 28, height = 10
raw = b'\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00...ff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff'
expected_raw = b'\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00...ff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff'
tolerance = 0

    def assert_pixels_equal(name, width, height, raw, expected_raw, tolerance=0):
        """Take 2 matrices of pixels and assert that they are the same."""
        if raw != expected_raw:  # pragma: no cover
            for i, (value, expected) in enumerate(zip(raw, expected_raw)):
                if abs(value - expected) > tolerance:
                    write_png(name, raw, width, height)
                    write_png(name + '.expected', expected_raw,
                              width, height)
                    pixel_n = i // 4
                    x = pixel_n // width
                    y = pixel_n % width
                    i % 4
                    pixel = tuple(list(raw[i:i + 4]))
                    expected_pixel = tuple(list(
                        expected_raw[i:i + 4]))
>                   assert 0, (
                        'Pixel (%i, %i) in %s: expected rgba%s, got rgba%s'
                        % (x, y, name, expected_pixel, pixel))
E                   AssertionError: Pixel (1, 2) in table_vertical_align: expected rgba(255, 0, 0, 255), got rgba(127, 0, 128, 255)

/build/python-weasyprint/src/WeasyPrint-52.2/weasyprint/tests/test_draw/__init__.py:160: AssertionError
------------------------------ Captured log call -------------------------------
INFO     weasyprint.progress:__init__.py:103 Step 1 - Fetching and parsing HTML - HTML string
INFO     weasyprint.progress:__init__.py:349 Step 2 - Fetching and parsing CSS - CSS string
INFO     weasyprint.progress:__init__.py:64 Step 3 - Applying CSS
INFO     weasyprint.progress:document.py:380 Step 4 - Creating formatting structure
INFO     weasyprint.progress:pages.py:794 Step 5 - Creating layout - Page 1
INFO     weasyprint.progress:document.py:775 Step 6 - Drawing
=============================== warnings summary ===============================
../../../../usr/lib/python3.9/site-packages/packaging/version.py:127: 240 warnings
  /usr/lib/python3.9/site-packages/packaging/version.py:127: DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/warnings.html
=========================== short test summary info ============================
FAILED weasyprint/tests/test_pdf.py::test_document_info - assert b"(201104212...
FAILED weasyprint/tests/test_draw/test_float.py::test_float_inline - Assertio...
FAILED weasyprint/tests/test_draw/test_float.py::test_float_inline_rtl - Asse...
FAILED weasyprint/tests/test_draw/test_float.py::test_float_inline_block - As...
FAILED weasyprint/tests/test_draw/test_float.py::test_float_inline_block_rtl
FAILED weasyprint/tests/test_draw/test_float.py::test_float_table - Assertion...
FAILED weasyprint/tests/test_draw/test_float.py::test_float_table_rtl - Asser...
FAILED weasyprint/tests/test_draw/test_float.py::test_float_inline_table - As...
FAILED weasyprint/tests/test_draw/test_float.py::test_float_inline_table_rtl
FAILED weasyprint/tests/test_draw/test_text.py::test_text_overflow_clip - Ass...
FAILED weasyprint/tests/test_draw/test_text.py::test_text_overflow_ellipsis
FAILED weasyprint/tests/test_draw/test_text.py::test_text_align_rtl_trailing_whitespace
FAILED weasyprint/tests/test_layout/test_table.py::test_table_vertical_align
========== 13 failed, 1285 passed, 11 xfailed, 240 warnings in 31.51s ==========

I do have the dejavu fonts installed, as well as gdk-pixbuf2, pango, and all the python module dependencies.

PKGBUILD
# Maintainer: Eli Schwartz <eschwartz@archlinux.org>

_pkgname=WeasyPrint
pkgname=python-weasyprint
pkgver=52.2
pkgrel=1
pkgdesc="visual rendering engine for HTML and CSS that can export to PDF and PNG"
arch=('any')
url="https://www.courtbouillon.org/weasyprint"
license=('BSD')
_py_deps=('cairocffi' 'cairosvg' 'cffi' 'cssselect2' 'html5lib' 'pillow'
          'pyphen' 'tinycss2')
depends=('gdk-pixbuf2' 'pango' "${_py_deps[@]/#/python-}")
makedepends=('python-setuptools')
checkdepends=('python-pytest' 'ttf-dejavu')
source=("https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/${_pkgname}/${_pkgname}-${pkgver}.tar.gz")
sha256sums=('21a1a9f11650ed14241817bf333a0ae0a42f6ae38cd7c2654845cb17352b7434')
b2sums=('33a41593dd50c8f4a5738f9e41b570219d83a512a6c00ccc9b0fa9ddf4ab1040e1c5c95eada833810a9c6bc07efbacc5735f6a5e341a6b8b01b128651b5c4fa4')

prepare(){
    cd "${srcdir}"/${_pkgname}-${pkgver}

    # test requirements should not be needed during build if tests are disabled
    sed -i 's/setup_requires = pytest-runner//' setup.cfg

    # thou shalt not lint coding style in integration tests
    sed -i 's/--flake8 --isort//' setup.cfg
}

build(){
    cd "${srcdir}"/${_pkgname}-${pkgver}

    python setup.py build
}

check() {
    cd "${srcdir}"/${_pkgname}-${pkgver}

    python -m pytest
}

package() {
    cd "${srcdir}"/${_pkgname}-${pkgver}

    python setup.py install --root="${pkgdir}" --optimize=1 --skip-build
    install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (12 by maintainers)

github_iconTop GitHub Comments

3reactions
liZecommented, Jan 26, 2021

Tests don’t pass probably because you have Cairo 1.17.x. Tests only pass with Cairo 1.16.x.

Thank you for confirming this is a bug in WeasyPrint.

No problem!

As Cairo suffers from technical and organizational problems (see Cairo’s mailing list), we decided to write our own PDF generator. It takes some time, that’s why there’s no release yet without Cairo.

That’s just an incredibly, incredibly weak argument. One person raises histrionics claiming that there’s no one in charge, less than 24 hours later the one in charge pops up and says “hi, of course I can make a release” but also begins a discussion about passing on the torch to a new release manager. I find it very difficult, based on that link, to even begin to understand why one might think cairo is unmaintained.

But hey, that’s all completely irrelevant. Dropping a complex binary dependency is not necessarily a bad thing, if you think you don’t need it. Just don’t blame it on “they have organizational problems”. 😃

We don’t want to use Cairo anymore for many reasons. I wrote that “Cairo suffers from technical and organizational problems” and gave an example, that’s all. I didn’t say that the organizational problems were the only reasons.

If you want to technical reasons (not the only ones):

  • Having multiple output formats makes Cairo really powerful, but also very complicated. Having one output format removes layers that are useless for us.
  • The available features for the output backends are often the features available for all formats, because it’s long and hard to have dedicated features for each format. Some PDF features have been added, but we would benefit from a library really dedicated to PDF generation.
  • Cairo is theoretically available for all platforms, but it’s not really packaged for Windows. As you said, dropping a complex binary is not necessarily a bad thing 😉.
  • Some of their technical choices cause problems that are hard (impossible?) to solve correctly. We don’t want nightmares like #742 anymore (just an example, I let you find other tickets).

And I definitely think and say that they have organizational problems.

  • The thread I mentioned follows another one two months earlier, complaining about the 1,5-year-old latest release. Nobody wants/can do the release in this thread.
  • Tests are broken, and that’s not because of the latest version of a dependency 😉. There are regressions in 1.17.4, and some are related to font rendering. Some failing tests in WeasyPrint probably fail because of that. And that’s not necessarily a bug in Cairo, just something that’s changed and that’s not documented.
  • According to Bryce, the person who released Cairo 1.17.2 and 1.17.4, Cairo 1.17.x are unstable releases.
  • Then why some Linux distributions and Homebrew distribute this unstable version? Because the latest stable version has been released more than two years ago and has a lot of bugs. And because the stable/unstable status is not really clear.
  • The Cairo team wants to release a new 1.16.x version. But what will happen on distributions where 1.17.x versions are marked as stable?

I really love the Cairo team, I really love the Cairo library, I have huge respect for what they do. This library is incredible. It’s just that it’s not adapted to WeasyPrint anymore, in our opinion. For technical reasons, for organizational reasons.

Might I recommend making sure unittests pass on your latest release, even if you’ve rewritten the code in unreleased master? It’s not exactly hard to hotfix this, either – pytest.mark.xfail(condition=cairocffi.cairo_version() >= 11700, reason="tests not yet updated to check 1.17").

Do you expect weasyprint to work on cairo 1.17 and it’s just a matter of unittests not being updated?

Version 53 of WeasyPrint will not use Cairo anymore. We may want to spend time on the 52.x versions in the future, to make it compatible with new stable versions of Cairo, but that’s not sure at all.

Tests currently don’t pass because some things are broken. Adding xfails won’t fix WeasyPrint with Cairo 1.17.x versions, that’s not a way to make “weasyprint to work on cairo 1.17” (unfortunately 😄).

It should not take more effort to if/else the tests based on cairo version than it would to go straight to the new version only. I would generally consider it advisable to test your software against the latest release of critical dependencies just for future proofing and to catch problems early, and you had several years to do it – so it’s a bit disappointing to not see this done, regardless of reasons.

Cairo 1.17.4 is not a Cairo release. It’s just a “development snapshot”. WeasyPrint 52.x is tested with “the latest release of critical dependencies”, which is 1.16.0 for Cairo.

We prefer to spend our time on WeasyPrint’s next version, instead of supporting next versions of Cairo. We took some time to write a PDF generator allowing us to fix many bugs caused by Cairo and to add many features. You may agree, you may disagree. You may even be disappointed.

I was disappointed too. To see that ArchLinux and Homebrew, for example, decided to include a Cairo snapshot just as if it was a stable release. But, well, they do what they want after all, they don’t owe me anything 😉. It’s not Arch’s fault. It’s not Cairo’s fault. It’s just hard to maintain free software and people often do their best.

We’ll be happy and grateful to merge a pull request fixing WeasyPrint with Cairo 1.17.4 in the 52.x branch. It’s just not our priority right now.

3reactions
liZecommented, Jan 25, 2021

Please, be kind ❤️.

It should probably be the business of a project which depends extensively on Cairo to keep itself up to date with Cairo.

Actually, the master branch of WeasyPrint doesn’t depend on Cairo anymore.

Having tests passing with both Cairo 1.16.x (that’s still used on many distributions) and 1.17.x (that were marked as unstable when they were released) requires a lot of work. As Cairo suffers from technical and organizational problems (see Cairo’s mailing list), we decided to write our own PDF generator. It takes some time, that’s why there’s no release yet without Cairo.

You can read more about that on #1232 (the issue is pinned, you can’t miss it).

Read more comments on GitHub >

github_iconTop Results From Across the Web

cairo 1.1.2 snapshot available
This snapshot is backwards-compatible with the 1.0 series---it ... development and is very close to passing the entire cairo test suite.
Read more >
NEWS
Skip tests if the system version of Cairo (actually the one gdtools was compiled with) doesn't match the version of Cairo used to...
Read more >
Jest: How to Update Snapshot Tests
Run the snapshot test, make sure it passes — if it does not pass, find the problem and fix it, don't change the...
Read more >
cairo snapshot 1.7.2 now available
There is more than 400 commits worth of changes in this snapshot, and those can use some testing. Read on! Text, text, and...
Read more >
cairo 1.5.2 snapshot available
NOTE: This is a snapshot of in-progress development, not a "release". ... For example, various tests in the test suite are currently failing ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found