Weasyprint test fails
See original GitHub issueOn 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:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This sounds like the issue could be bumped up to the Weasy folks.
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.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.