unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#42409: weasyprint fails to build
@ 2020-07-17 17:51 Michael Rohleder
  2020-11-29 19:09 ` Maxim Cournoyer
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Rohleder @ 2020-07-17 17:51 UTC (permalink / raw)
  To: 42409

[-- Attachment #1: Type: text/plain, Size: 7838 bytes --]

weasyprint fails in tests:

...
=================================== FAILURES ===================================
__________________________________ test_acid2 __________________________________

    @assert_no_logs
    @requires('cairo', (1, 12, 0))
    def test_acid2():
        def render(filename):
            return HTML(resource_filename(filename)).render(enable_hinting=True)
    
        with capture_logs():
            # This is a copy of http://www.webstandards.org/files/acid2/test.html
            document = render('acid2-test.html')
            intro_page, test_page = document.pages
            # Ignore the intro page: it is not in the reference
            test_image, width, height = document.copy(
                [test_page]).write_image_surface()
    
        # This is a copy of http://www.webstandards.org/files/acid2/reference.html
        ref_image, ref_width, ref_height = render(
            'acid2-reference.html').write_image_surface()
    
        assert (width, height) == (ref_width, ref_height)
>       assert_pixels_equal(
            'acid2', width, height, image_to_pixels(test_image, width, height),
            image_to_pixels(ref_image, width, height), tolerance=2)

weasyprint/tests/test_acid2.py:37: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'acid2', width = 794, height = 1123
raw = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
expected_raw = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
tolerance = 2

    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 (124, 160) in acid2: expected rgba(191, 127, 127, 255), got rgba(128, 0, 0, 255)

weasyprint/tests/test_draw/__init__.py:163: AssertionError
------------------------------ Captured log call -------------------------------
INFO     weasyprint.progress:__init__.py:106 Step 1 - Fetching and parsing HTML - /tmp/guix-build-weasyprint-51.drv-0/WeasyPrint-51/weasyprint/tests/resources/acid2-test.html
INFO     weasyprint.progress:__init__.py:315 Step 2 - Fetching and parsing CSS - CSS string
WARNING  weasyprint:__init__.py:825 Invalid or unsupported selector '[class=second two] ', (<IdentToken two>, 'expected ], got ident')
WARNING  weasyprint:__init__.py:86 Ignored `error: \}` at 90:74, unknown property.
WARNING  weasyprint:__init__.py:86 Ignored `m
rgin: 2em` at 93:14, unknown property.
WARNING  weasyprint:__init__.py:825 Invalid or unsupported selector ';
   .parser ', (<LiteralToken ;>, 'expected a compound selector, got literal')
WARNING  weasyprint:__init__.py:86 Ignored `width: 200` at 95:14, invalid value.
WARNING  weasyprint:__init__.py:86 Ignored `border: 5em solid red ! error` at 96:14, invalid value.
WARNING  weasyprint:__init__.py:86 Ignored `background: red pink` at 97:14, invalid value.
INFO     weasyprint.progress:__init__.py:315 Step 2 - Fetching and parsing CSS - data:text/css,.picture%20%7B%20background%3A%20none%3B%20%7D
INFO     weasyprint.progress:__init__.py:67 Step 3 - Applying CSS
INFO     weasyprint.progress:document.py:371 Step 4 - Creating formatting structure
ERROR    weasyprint:images.py:231 Failed to load image at "file:///tmp/guix-build-weasyprint-51.drv-0/WeasyPrint-51/weasyprint/tests/resources/404" (URLError: <urlopen error [Errno 2] No such file or directory: '/tmp/guix-build-weasyprint-51.drv-0/WeasyPrint-51/weasyprint/tests/resources/404'>)
ERROR    weasyprint:images.py:231 Failed to load image at "data:application/x-unknown,ERROR" (Pixbuf error: Unrecognized image file format)
INFO     weasyprint.progress:pages.py:798 Step 5 - Creating layout - Page 1
INFO     weasyprint.progress:pages.py:798 Step 5 - Creating layout - Page 2
INFO     weasyprint.progress:document.py:751 Step 6 - Drawing
INFO     weasyprint.progress:__init__.py:106 Step 1 - Fetching and parsing HTML - /tmp/guix-build-weasyprint-51.drv-0/WeasyPrint-51/weasyprint/tests/resources/acid2-reference.html
INFO     weasyprint.progress:__init__.py:315 Step 2 - Fetching and parsing CSS - CSS string
INFO     weasyprint.progress:__init__.py:67 Step 3 - Applying CSS
INFO     weasyprint.progress:document.py:371 Step 4 - Creating formatting structure
INFO     weasyprint.progress:pages.py:798 Step 5 - Creating layout - Page 1
INFO     weasyprint.progress:document.py:751 Step 6 - Drawing
______________________________ test_line_content _______________________________

    @assert_no_logs
    def test_line_content():
        for width, remaining in [(100, 'text for test'),
                                 (45, 'is a text for test')]:
            text = 'This is a text for test'
            _, length, resume_at, _, _, _ = make_text(
                text, width, font_family=SANS_FONTS.split(','), font_size=19)
>           assert text[resume_at:] == remaining
E           AssertionError: assert 'a text for test' == 'text for test'
E             - a text for test
E             ? --
E             + text for test

../../../WeasyPrint-51/weasyprint/tests/test_text.py:37: AssertionError
______________________________ test_line_breaking ______________________________

    @assert_no_logs
    def test_line_breaking():
        string = 'Thïs is a text for test'
    
        # These two tests do not really rely on installed fonts
        _, _, resume_at, _, _, _ = make_text(string, 90, font_size=1)
        assert resume_at is None
    
        _, _, resume_at, _, _, _ = make_text(string, 90, font_size=100)
        assert string.encode('utf-8')[resume_at:].decode('utf-8') == (
            'is a text for test')
    
        _, _, resume_at, _, _, _ = make_text(
            string, 100, font_family=SANS_FONTS.split(','), font_size=19)
>       assert string.encode('utf-8')[resume_at:].decode('utf-8') == (
            'text for test')
E       AssertionError: assert 'a text for test' == 'text for test'
E         - a text for test
E         ? --
E         + text for test

../../../WeasyPrint-51/weasyprint/tests/test_text.py:62: AssertionError

...

= 41 failed, 1132 passed, 1 deselected, 7 xfailed, 1 warning in 84.56s (0:01:24) =
command "pytest" "-k" "not test_flex_column_wrap_reverse" failed with status 1
builder for `/gnu/store/5c9h7c9pnrbpmk1015vrckrwsf5hd5xr-weasyprint-51.drv' failed with exit code 1


-- 
"We all know Linux is great...it does infinite loops in 5 seconds."
(Linus Torvalds about the superiority of Linux on the Amterdam
Linux Symposium)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#42409: weasyprint fails to build
  2020-07-17 17:51 bug#42409: weasyprint fails to build Michael Rohleder
@ 2020-11-29 19:09 ` Maxim Cournoyer
  0 siblings, 0 replies; 2+ messages in thread
From: Maxim Cournoyer @ 2020-11-29 19:09 UTC (permalink / raw)
  To: Michael Rohleder; +Cc: 42409-done

Hello,

Michael Rohleder <mike@rohleder.de> writes:

> weasyprint fails in tests:
>
> ...
> =================================== FAILURES ===================================
>
>
>     @assert_no_logs
>     @requires('cairo', (1, 12, 0))
>     def test_acid2():
>         def render(filename):
>             return HTML(resource_filename(filename)).render(enable_hinting=True)
>     
>         with capture_logs():
>             # This is a copy of http://www.webstandards.org/files/acid2/test.html
>             document = render('acid2-test.html')
>             intro_page, test_page = document.pages
>             # Ignore the intro page: it is not in the reference
>             test_image, width, height = document.copy(
>                 [test_page]).write_image_surface()
>     
>         # This is a copy of http://www.webstandards.org/files/acid2/reference.html
>         ref_image, ref_width, ref_height = render(
>             'acid2-reference.html').write_image_surface()
>     
>         assert (width, height) == (ref_width, ref_height)
>>       assert_pixels_equal(
>             'acid2', width, height, image_to_pixels(test_image, width, height),
>             image_to_pixels(ref_image, width, height), tolerance=2)
>
> weasyprint/tests/test_acid2.py:37: 
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>
> name = 'acid2', width = 794, height = 1123
> raw = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
> expected_raw = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
> tolerance = 2
>
>     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 (124, 160) in acid2: expected rgba(191, 127, 127, 255), got rgba(128, 0, 0, 255)
>
> weasyprint/tests/test_draw/__init__.py:163: AssertionError
>
> INFO weasyprint.progress:__init__.py:106 Step 1 - Fetching and parsing
> HTML -
> /tmp/guix-build-weasyprint-51.drv-0/WeasyPrint-51/weasyprint/tests/resources/acid2-test.html
> INFO     weasyprint.progress:__init__.py:315 Step 2 - Fetching and parsing CSS - CSS string
> WARNING weasyprint:__init__.py:825 Invalid or unsupported selector
> '[class=second two] ', (<IdentToken two>, 'expected ], got ident')
> WARNING  weasyprint:__init__.py:86 Ignored `error: \}` at 90:74, unknown property.
> WARNING  weasyprint:__init__.py:86 Ignored `m
> rgin: 2em` at 93:14, unknown property.
> WARNING  weasyprint:__init__.py:825 Invalid or unsupported selector ';
>    .parser ', (<LiteralToken ;>, 'expected a compound selector, got literal')
> WARNING  weasyprint:__init__.py:86 Ignored `width: 200` at 95:14, invalid value.
> WARNING  weasyprint:__init__.py:86 Ignored `border: 5em solid red ! error` at 96:14, invalid value.
> WARNING  weasyprint:__init__.py:86 Ignored `background: red pink` at 97:14, invalid value.
> INFO weasyprint.progress:__init__.py:315 Step 2 - Fetching and parsing
> CSS - data:text/css,.picture%20%7B%20background%3A%20none%3B%20%7D
> INFO     weasyprint.progress:__init__.py:67 Step 3 - Applying CSS
> INFO     weasyprint.progress:document.py:371 Step 4 - Creating formatting structure
> ERROR weasyprint:images.py:231 Failed to load image at
> "file:///tmp/guix-build-weasyprint-51.drv-0/WeasyPrint-51/weasyprint/tests/resources/404"
> (URLError: <urlopen error [Errno 2] No such file or directory:
> '/tmp/guix-build-weasyprint-51.drv-0/WeasyPrint-51/weasyprint/tests/resources/404'>)
> ERROR weasyprint:images.py:231 Failed to load image at
> "data:application/x-unknown,ERROR" (Pixbuf error: Unrecognized image
> file format)
> INFO     weasyprint.progress:pages.py:798 Step 5 - Creating layout - Page 1
> INFO     weasyprint.progress:pages.py:798 Step 5 - Creating layout - Page 2
> INFO     weasyprint.progress:document.py:751 Step 6 - Drawing
> INFO weasyprint.progress:__init__.py:106 Step 1 - Fetching and parsing
> HTML -
> /tmp/guix-build-weasyprint-51.drv-0/WeasyPrint-51/weasyprint/tests/resources/acid2-reference.html
> INFO     weasyprint.progress:__init__.py:315 Step 2 - Fetching and parsing CSS - CSS string
> INFO     weasyprint.progress:__init__.py:67 Step 3 - Applying CSS
> INFO     weasyprint.progress:document.py:371 Step 4 - Creating formatting structure
> INFO     weasyprint.progress:pages.py:798 Step 5 - Creating layout - Page 1
> INFO     weasyprint.progress:document.py:751 Step 6 - Drawing
>
>
>     @assert_no_logs
>     def test_line_content():
>         for width, remaining in [(100, 'text for test'),
>                                  (45, 'is a text for test')]:
>             text = 'This is a text for test'
>             _, length, resume_at, _, _, _ = make_text(
>                 text, width, font_family=SANS_FONTS.split(','), font_size=19)
>>           assert text[resume_at:] == remaining
> E           AssertionError: assert 'a text for test' == 'text for test'
> E             - a text for test
> E             ? --
> E             + text for test
>
> ../../../WeasyPrint-51/weasyprint/tests/test_text.py:37: AssertionError
>
>     @assert_no_logs
>     def test_line_breaking():
>         string = 'Thïs is a text for test'
>     
>         # These two tests do not really rely on installed fonts
>         _, _, resume_at, _, _, _ = make_text(string, 90, font_size=1)
>         assert resume_at is None
>     
>         _, _, resume_at, _, _, _ = make_text(string, 90, font_size=100)
>         assert string.encode('utf-8')[resume_at:].decode('utf-8') == (
>             'is a text for test')
>     
>         _, _, resume_at, _, _, _ = make_text(
>             string, 100, font_family=SANS_FONTS.split(','), font_size=19)
>>       assert string.encode('utf-8')[resume_at:].decode('utf-8') == (
>             'text for test')
> E       AssertionError: assert 'a text for test' == 'text for test'
> E         - a text for test
> E         ? --
> E         + text for test
>
> ../../../WeasyPrint-51/weasyprint/tests/test_text.py:62: AssertionError
>
> ...
>
> = 41 failed, 1132 passed, 1 deselected, 7 xfailed, 1 warning in 84.56s (0:01:24) =
> command "pytest" "-k" "not test_flex_column_wrap_reverse" failed with status 1
> builder for `/gnu/store/5c9h7c9pnrbpmk1015vrckrwsf5hd5xr-weasyprint-51.drv' failed with exit code 1

These failures were due to the 'DejaVu Sans' font not being available.
This is now fixed, along with an updated Weasyprint and some of its
dependencies, as of commit c601e2bf9adb05dc9dd9f3a565f693e968eb785c.

Thank you for the report!

Closing.

Maxim




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-29 19:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-17 17:51 bug#42409: weasyprint fails to build Michael Rohleder
2020-11-29 19:09 ` Maxim Cournoyer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).