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.

Weasyprint test fails

See original GitHub issue

On NixOS the build process for the packages fails. I’m not sure if it’s an issue with the setup or the test.

============================= test session starts ==============================
platform linux -- Python 3.8.9, pytest-6.2.3, py-1.10.0, pluggy-0.13.1
rootdir: /build/source
collected 7 items                                                              

tests/test_basics.py ....                                                [ 57%]
tests/test_third_parties.py F..                                          [100%]

=================================== FAILURES ===================================
_______________________________ test_weasyprint ________________________________

tmpdir = local('/build/pytest-of-nixbld/pytest-0/test_weasyprint0')

    def test_weasyprint(tmpdir):
        path = str(tmpdir)
        root = file_tree(str(tmpdir))  # or 'archive.zip' to write in an archive.
        html = weasyprint.HTML(string="<b>Hello</b> world!", base_url=".")
        html.write_pdf(root._dir("pdfs")._file("test.pdf"))
        with open(os.path.join(path, "pdfs", "test.pdf"), "rb") as f:
            filesize = len(f.read())
>           assert 8000 < filesize
E           assert 8000 < 5456

tests/test_third_parties.py:26: AssertionError
=========================== short test summary info ============================
FAILED tests/test_third_parties.py::test_weasyprint - assert 8000 < 5456
========================= 1 failed, 6 passed in 1.97s ==========================

Thanks

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Zulkocommented, May 30, 2021

This suggest that weasyprint does not work as intended on your system.

This sounds like the issue could be bumped up to the Weasy folks.

(However, weasyprint is not a real dependency of flametree and is used only for the test, so there is a good argument for not making build success to be dependent on this test and third party libraries.)

This test (like the other tests in the same file) is actually some sort of integration test (I should probably have written that in the file). There are several EGF projects which write PDFs with the same way this test does, and the test protects Flametree against changes that would inadvertently break all these projects. So I would advise against removing it. The ideal path would be to fix Weasyprint on NixOS, or if that’s too complicated adapt the test by having the last line read assert 5000 < filesize (instead of 8000), which is less specific but sounds reasonable to me.

1reaction
veghpcommented, May 29, 2021

I’ve restarted the CI test and it passes; also passes locally. Therefore this may be related to your setup – @fabaff can you please open and check if the pdf generated by the test is valid? It should be in /tmp/pytest-of-username/pytest-0/test_weasyprintcurrent/pdfs/test.pdf or similar.

Read more comments on GitHub >

github_iconTop Results From Across the Web

weasyprint fails to build on rawhide, test failures + segfault
weasyprint fails to build with Python 3.10.0a6 and Python 3.9.2 on rawhide. + pytest-3 -k 'not test_text and not test_float and not ...
Read more >
python - Problem with weasyprint, when running pyhton file
Hi I am trying to convert html document to pdf using weasyprint, but when ever I run the script an error appears weasyprint...
Read more >
weasyprint fails to build - Guix issue tracker
weasyprint fails in tests: ... weasyprint/tests/test_acid2.py:37: ... weasyprint/tests/test_draw/__init__.py:163: AssertionError.
Read more >
WeasyPrint 43 documentation - GitHub Pages
The test suite passes on cairo 1.14, and passes with some tests marked as “expected failures” on 1.10 and 1.12 due to behavior...
Read more >
WeasySuite - cursor-x-y-002 - Test Suites
If you are on a device without a cursor, skip this test. Otherwise, if the cursor does not look like a red and...
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