unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: Michael Rohleder <mike@rohleder.de>
Cc: 42409-done@debbugs.gnu.org
Subject: bug#42409: weasyprint fails to build
Date: Sun, 29 Nov 2020 14:09:11 -0500	[thread overview]
Message-ID: <87a6v0nfoo.fsf@gmail.com> (raw)
In-Reply-To: <87o8oem3n7.fsf@rohleder.de> (Michael Rohleder's message of "Fri,  17 Jul 2020 19:51:08 +0200")

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




      reply	other threads:[~2020-11-29 19:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-17 17:51 bug#42409: weasyprint fails to build Michael Rohleder
2020-11-29 19:09 ` Maxim Cournoyer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a6v0nfoo.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=42409-done@debbugs.gnu.org \
    --cc=mike@rohleder.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).