Kozea / WeasyPrint

The awesome document factory
https://weasyprint.org
BSD 3-Clause "New" or "Revised" License
7.16k stars 680 forks source link

py.test failing on clean clone #354

Closed johnlb closed 8 years ago

johnlb commented 8 years ago

So, just tried running unit tests on WeasyPrint using a fresh clone and came up with a bunch of failures. I assume it is something on my end, but I thought I'd check to see if this is a known thing?

Running Ubuntu 16, can reproduce on both python 2.7 and 3.5.

Here is the output of py.test (I Interrupted it because it seems to hang up on this last test...):

(python3) johnlb@this-lappy:~/opensource/WeasyPrint$ py.test -v =============================== test session starts ================================ platform linux -- Python 3.5.2, pytest-3.0.2, py-1.4.31, pluggy-0.3.1 -- /home/johnlb/Envs/python3/bin/python3 cachedir: .cache rootdir: /home/johnlb/opensource/WeasyPrint, inifile: pytest.ini collected 168 items

weasyprint/tests/test_api.py::test_html_parsing PASSED weasyprint/tests/test_api.py::test_css_parsing PASSED weasyprint/tests/test_api.py::test_python_render PASSED weasyprint/tests/test_api.py::test_command_line_render PASSED weasyprint/tests/test_api.py::test_unicode_filenames PASSED weasyprint/tests/test_api.py::test_low_level_api PASSED weasyprint/tests/test_api.py::test_bookmarks PASSED weasyprint/tests/test_api.py::test_links PASSED weasyprint/tests/test_api.py::test_navigator PASSED weasyprint/tests/test_api.py::test_url_fetcher PASSED weasyprint/tests/test_api.py::test_html_meta PASSED weasyprint/tests/test_api.py::test_http PASSED weasyprint/tests/test_boxes.py::test_box_tree PASSED weasyprint/tests/test_boxes.py::test_html_entities PASSED weasyprint/tests/test_boxes.py::test_inline_in_block PASSED weasyprint/tests/test_boxes.py::test_block_in_inline PASSED weasyprint/tests/test_boxes.py::test_styles PASSED weasyprint/tests/test_boxes.py::test_whitespace PASSED weasyprint/tests/test_boxes.py::test_page_style PASSED weasyprint/tests/test_boxes.py::test_images PASSED weasyprint/tests/test_boxes.py::test_tables PASSED weasyprint/tests/test_boxes.py::test_table_style PASSED weasyprint/tests/test_boxes.py::test_column_style PASSED weasyprint/tests/test_boxes.py::test_nested_grid_x PASSED weasyprint/tests/test_boxes.py::test_colspan_rowspan PASSED weasyprint/tests/test_boxes.py::test_before_after PASSED weasyprint/tests/test_boxes.py::test_counters PASSED weasyprint/tests/test_boxes.py::test_counter_styles PASSED weasyprint/tests/test_boxes.py::test_margin_boxes PASSED weasyprint/tests/test_boxes.py::test_margin_box_string_set PASSED weasyprint/tests/test_boxes.py::test_page_counters PASSED weasyprint/tests/test_boxes.py::test_border_collapse PASSED weasyprint/tests/test_css.py::test_data_url PASSED weasyprint/tests/test_css.py::test_style_dict PASSED weasyprint/tests/test_css.py::test_find_stylesheets PASSED weasyprint/tests/test_css.py::test_expand_shorthands PASSED weasyprint/tests/test_css.py::test_annotate_document FAILED weasyprint/tests/test_css.py::test_page PASSED weasyprint/tests/test_css.py::test_warnings PASSED weasyprint/tests/test_css.py::test_error_recovery PASSED weasyprint/tests/test_css.py::test_line_height_inheritance PASSED weasyprint/tests/test_css.py::test_important PASSED weasyprint/tests/test_css.py::test_units FAILED weasyprint/tests/test_css_validation.py::test_not_print PASSED weasyprint/tests/test_css_validation.py::test_function PASSED weasyprint/tests/test_css_validation.py::test_counters PASSED weasyprint/tests/test_css_validation.py::test_spacing PASSED weasyprint/tests/test_css_validation.py::test_decoration PASSED weasyprint/tests/test_css_validation.py::test_size PASSED weasyprint/tests/test_css_validation.py::test_transforms PASSED weasyprint/tests/test_css_validation.py::test_expand_four_sides PASSED weasyprint/tests/test_css_validation.py::test_expand_borders PASSED weasyprint/tests/test_css_validation.py::test_expand_list_style PASSED weasyprint/tests/test_css_validation.py::test_expand_background PASSED weasyprint/tests/test_css_validation.py::test_expand_background_position PASSED weasyprint/tests/test_css_validation.py::test_font PASSED weasyprint/tests/test_css_validation.py::test_line_height PASSED weasyprint/tests/test_css_validation.py::test_string_set PASSED weasyprint/tests/test_css_validation.py::test_linear_gradient PASSED weasyprint/tests/test_css_validation.py::test_overflow_wrap PASSED weasyprint/tests/test_css_validation.py::test_expand_word_wrap PASSED weasyprint/tests/test_css_validation.py::test_radial_gradient PASSED weasyprint/tests/test_draw.py::test_canvas_background PASSED weasyprint/tests/test_draw.py::test_background_image PASSED weasyprint/tests/test_draw.py::test_background_origin PASSED weasyprint/tests/test_draw.py::test_background_repeat_space PASSED weasyprint/tests/test_draw.py::test_background_repeat_round PASSED weasyprint/tests/test_draw.py::test_background_clip PASSED weasyprint/tests/test_draw.py::test_background_size PASSED weasyprint/tests/test_draw.py::test_list_style_image PASSED weasyprint/tests/test_draw.py::test_images PASSED weasyprint/tests/test_draw.py::test_image_resolution PASSED weasyprint/tests/test_draw.py::test_visibility PASSED weasyprint/tests/test_draw.py::test_tables PASSED weasyprint/tests/test_draw.py::test_before_after PASSED weasyprint/tests/test_draw.py::test_borders PASSED weasyprint/tests/test_draw.py::test_outlines PASSED weasyprint/tests/test_draw.py::test_small_borders PASSED weasyprint/tests/test_draw.py::test_margin_boxes PASSED weasyprint/tests/test_draw.py::test_unicode PASSED weasyprint/tests/test_draw.py::test_overflow PASSED weasyprint/tests/test_draw.py::test_clip PASSED weasyprint/tests/test_draw.py::test_opacity PASSED weasyprint/tests/test_draw.py::test_current_color PASSED weasyprint/tests/test_draw.py::test_2d_transform PASSED weasyprint/tests/test_draw.py::test_acid2 PASSED weasyprint/tests/test_draw.py::test_linear_gradients PASSED weasyprint/tests/test_draw.py::test_radial_gradients PASSED weasyprint/tests/test_layout.py::test_page_size PASSED weasyprint/tests/test_layout.py::test_block_widths PASSED weasyprint/tests/test_layout.py::test_block_heights PASSED weasyprint/tests/test_layout.py::test_block_percentage_heights PASSED weasyprint/tests/test_layout.py::test_inline_block_sizes PASSED weasyprint/tests/test_layout.py::test_lists PASSED weasyprint/tests/test_layout.py::test_empty_linebox xfail weasyprint/tests/test_layout.py::test_breaking_linebox PASSED weasyprint/tests/test_layout.py::test_linebox_text PASSED weasyprint/tests/test_layout.py::test_linebox_positions PASSED weasyprint/tests/test_layout.py::test_forced_line_breaks PASSED weasyprint/tests/test_layout.py::test_page_breaks PASSED weasyprint/tests/test_layout.py::test_orphans_widows_avoid PASSED weasyprint/tests/test_layout.py::test_inlinebox_spliting PASSED weasyprint/tests/test_layout.py::test_page_and_linebox_breaking PASSED weasyprint/tests/test_layout.py::test_whitespace_processing PASSED weasyprint/tests/test_layout.py::test_images PASSED weasyprint/tests/test_layout.py::test_vertical_align FAILED weasyprint/tests/test_layout.py::test_inline_replaced_auto_margins PASSED weasyprint/tests/test_layout.py::test_empty_inline_auto_margins PASSED weasyprint/tests/test_layout.py::test_box_sizing PASSED weasyprint/tests/test_layout.py::test_margin_boxes_fixed_dimension PASSED weasyprint/tests/test_layout.py::test_preferred_widths FAILED weasyprint/tests/test_layout.py::test_margin_boxes_variable_dimension PASSED weasyprint/tests/test_layout.py::test_margin_boxes_vertical_align PASSED weasyprint/tests/test_layout.py::test_margin_collapsing PASSED weasyprint/tests/test_layout.py::test_relative_positioning PASSED weasyprint/tests/test_layout.py::test_absolute_positioning PASSED weasyprint/tests/test_layout.py::test_absolute_images PASSED weasyprint/tests/test_layout.py::test_fixed_positioning PASSED weasyprint/tests/test_layout.py::test_floats PASSED weasyprint/tests/test_layout.py::test_floats_page_breaks PASSED weasyprint/tests/test_layout.py::test_font_stretch FAILED weasyprint/tests/test_layout.py::test_box_decoration_break PASSED weasyprint/tests/test_layout.py::test_hyphenation PASSED weasyprint/tests/test_layout.py::test_linear_gradient PASSED weasyprint/tests/test_layout.py::test_radial_gradient PASSED weasyprint/tests/test_layout.py::test_shrink_to_fit_floating_point_error ^C

===================================== FAILURES ===================================== __ test_annotate_document __ weasyprint/tests/test_css.py:166: in test_annotate_document assert ul.margin_top == (40, 'px') E assert Dimension(val...44, unit='px') == (40, 'px') E At index 0 diff: 27.344 != 40 E Full diff: E - Dimension(value=27.344, unit='px') E + (40, 'px') ____ test_units ____ weasyprint/tests/test_css.py:413: in test_units assert margins == [96, 96, 96, 96, 96, 96, 96, 17.6, 17.6, 15.4, 12] E assert [96, 96.0, 96....0, 96.0, ...] == [96, 96, 96, 96, 96, 96, ...] E At index 9 diff: 9.797949 != 15.4 E Full diff: E - [96, 96.0, 96.0, 96.0, 96.0, 96.0, 96.0, 17.6, 17.6, 9.797949, 8.2032] E ? -- -- -- -- -- -- ^ ---- - ^^^^^ E + [96, 96, 96, 96, 96, 96, 96, 17.6, 17.6, 15.4, 12] E ? ^^ ^ _ test_vertical_align ____ weasyprint/tests/test_layout.py:1550: in test_vertical_align assert img_1.position_y == 35.2 # 60 - 0.5 * 0.8 * font-size - 40/2 E assert 36.718720000000005 == 35.2 E + where 36.718720000000005 = .position_y __ test_preferredwidths weasyprint/tests/test_layout.py:2061: in test_preferred_widths assert get_float_width(10) == len('consectetur elit') * 16 E assert 124.0 == (16 * 16) E + where 124.0 = <function test_preferred_widths..get_float_width at 0x7f9661a048c8>(10) E + and 16 = len('consectetur\xa0elit') ____ test_fontstretch ____ weasyprint/tests/test_layout.py:3219: in test_font_stretch assert condensed < normal E assert 106.0 < 106.0 ============================== pytest-warning summary ============================== WC1 /home/johnlb/opensource/WeasyPrint/weasyprint/tests/test_api.py cannot collect test class 'TestHTML' because it has a init constructor WC1 /home/johnlb/opensource/WeasyPrint/weasyprint/tests/test_boxes.py cannot collect test class 'TestHTML' because it has a init constructor WC1 /home/johnlb/opensource/WeasyPrint/weasyprint/tests/test_css.py cannot collect test class 'TestHTML' because it has a init constructor WC1 /home/johnlb/opensource/WeasyPrint/weasyprint/tests/test_draw.py cannot collect test class 'TestHTML' because it has a init constructor WC1 /home/johnlb/opensource/WeasyPrint/weasyprint/tests/test_pdf.py cannot collect test class 'TestHTML' because it has a init constructor !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! KeyboardInterrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! to show a full traceback on KeyboardInterrupt use --fulltrace /home/johnlb/Envs/python3/lib/python3.5/site-packages/html5lib/treebuilders/etree_lxml.py:240: KeyboardInterrupt ======= 5 failed, 119 passed, 1 xfailed, 5 pytest-warnings in 22.35 seconds ========

liZe commented 8 years ago

Thanks for the report!

To make the tests pass, you need:

johnlb commented 8 years ago

Ok. I've installed the dejavu font (through apt-get) and copied Ahem.ttf into ~/.fonts/

That seemed to take care of the test_font_stretch error, but the others are still there.

liZe commented 8 years ago

After copying Ahem to ~/.fonts, you probably have to launch fc-cache to update the font cache.

johnlb commented 8 years ago

Hey! Lookit that, it passes now. I actually somehow got a corrupt version of ahem.ttf. Grabbed the version from W3C and everything is ok.

I'm going to add a couple lines about this in the docs, if that's ok. Or did I miss that bit somewhere?

Thanks!

liZe commented 8 years ago

I'm going to add a couple lines about this in the docs, if that's ok.

No problem, thanks a lot!