Subject: Fix/skip some tests, because we need         to drop some binary files which leads to failures.
From: Anton Gladky <gladk@debian.org>
Last-Update: 2021-01-20

Date: Sun, 12 May 2024 22:42:14 +0100


---
 pytest.ini                             | 2 +-
 tests/test_bitmap_font.py              | 7 +++++++
 tests/test_character.py                | 4 +++-
 tests/test_linux_framebuffer_device.py | 2 ++
 4 files changed, 13 insertions(+), 2 deletions(-)

Index: luma.core/pytest.ini
===================================================================
--- luma.core.orig/pytest.ini
+++ luma.core/pytest.ini
@@ -1,2 +1,2 @@
 [pytest]
-addopts = --timeout=10 -v -r wsx -s
+addopts = -v -r wsx -s
Index: luma.core/tests/test_bitmap_font.py
===================================================================
--- luma.core.orig/tests/test_bitmap_font.py
+++ luma.core/tests/test_bitmap_font.py
@@ -112,6 +112,7 @@ def make_sprite_table(fnt):
 
 @pytest.fixture()
 def bm_font(request):
+    pytest.skip()
     """
     Fixture which loads a ``bitmap_font`` persists it to disk
     The fixture removes the file when it is finished.
@@ -148,6 +149,7 @@ def load_all_embedded(request):
 
 
 def test_load_from_pillow_font():
+    pytest.skip()
     """
     Test the loading of a pillow font from disk by loading the font from bitmap_font
     and PIL.ImageFont, rendering a page of glyphs which each and testing to make
@@ -164,6 +166,7 @@ def test_load_from_pillow_font():
 
 
 def test_load_from_pillow_exceptions():
+    pytest.skip()
     """
     Test that exceptions are thrown as appropriate if bitmap_font is asked to
     load a pillow font that is not a PIL.ImageFont file, is damaged or does not
@@ -192,6 +195,7 @@ def test_load_from_pillow_exceptions():
 
 
 def test_mapping():
+    pytest.skip()
     """
     Test to make sure that values that have unicode mappings work correctly
     """
@@ -212,6 +216,7 @@ def test_mapping():
 
 
 def test_load_sprite_table():
+    pytest.skip()
     """
     Test loading a font from a sprite_table
     """
@@ -226,6 +231,7 @@ def test_load_sprite_table():
 
 
 def test_load_sprite_table_exceptions_1():
+    pytest.skip()
     """
     Test that exceptions are thrown as appropriate if bitmap_font is asked to
     load from a sprite table from a filename that does not exist, is not a
@@ -238,6 +244,7 @@ def test_load_sprite_table_exceptions_1(
 
 
 def test_load_sprite_table_exceptions_2():
+    pytest.skip()
     """
     Test that exceptions are thrown as appropriate if bitmap_font is asked to
     load from a sprite table from a filename that does not exist, is not a
@@ -254,6 +261,7 @@ def test_load_sprite_table_exceptions_2(
 
 
 def test_dumps_loads_saves_load(bm_font):
+    pytest.skip()
     """
     Test which verifies the loading and restoring of bitmap_fonts
     """
Index: luma.core/tests/test_character.py
===================================================================
--- luma.core.orig/tests/test_character.py
+++ luma.core/tests/test_character.py
@@ -10,9 +10,10 @@ from luma.core.device import dummy
 from luma.core.virtual import character
 
 from helpers import get_reference_file, get_reference_image, assert_identical_image
-
+import pytest
 
 def test_init():
+    pytest.skip()
     path = get_reference_file(Path('font').joinpath('hd44780a02.pil'))
     fnt = ImageFont.load(path)
     device = dummy(width=80, height=16, mode="1")
@@ -21,6 +22,7 @@ def test_init():
 
 
 def test_setter_getter():
+    pytest.skip()
     fnt_path = get_reference_file(Path('font').joinpath('hd44780a02.pil'))
     img_path = get_reference_image('character_golden_ratio.png')
 
Index: luma.core/tests/test_linux_framebuffer_device.py
===================================================================
--- luma.core.orig/tests/test_linux_framebuffer_device.py
+++ luma.core/tests/test_linux_framebuffer_device.py
@@ -32,6 +32,7 @@ def swap_red_and_blue(data, step):
 
 
 def test_display_id_as_dev_fb_number():
+    pytest.skip()
     with patch("builtins.open", multi_mock_open(SCREEN_RES, BITS_PER_PIXEL, None)):
         device = linux_framebuffer("/dev/fb9")
         assert device.id == 9
@@ -79,6 +80,7 @@ def test_read_bits_per_pixel():
     (32, True),
 ])
 def test_display(bits_per_pixel, bgr):
+    pytest.skip()
     bytes_per_pixel = bits_per_pixel // 8
     with open(get_reference_file(f"fb_{bits_per_pixel}bpp.raw"), "rb") as fp:
         reference = fp.read()
Index: luma.core/tests/test_terminal.py
===================================================================
--- luma.core.orig/tests/test_terminal.py
+++ luma.core/tests/test_terminal.py
@@ -13,10 +13,12 @@ from luma.core.device import dummy
 from luma.core.virtual import terminal
 
 from helpers import (get_reference_image, assert_identical_image,
-    get_reference_font, test_font)
+    get_reference_font)
 
+import pytest
 
 def assert_text(device, term, reference_img, text, save=None):
+    pytest.skip()
     img_path = get_reference_image(reference_img)
 
     with open(img_path, 'rb') as fp:
@@ -32,9 +34,10 @@ def assert_text(device, term, reference_
 
 
 def test_default_text():
+    pytest.skip()
     reference = 'quick_brown_fox.png'
     device = dummy()
-    term = terminal(device, font=test_font)
+    term = terminal(device)
 
     assert_text(device, term, reference, [
         "The quick brown fox jumps over the lazy dog"
@@ -42,9 +45,10 @@ def test_default_text():
 
 
 def test_wrapped_text():
+    pytest.skip()
     reference = 'quick_brown_fox_word_wrap.png'
     device = dummy()
-    term = terminal(device, font=test_font, word_wrap=True, animate=False)
+    term = terminal(device, word_wrap=True, animate=False)
 
     assert_text(device, term, reference, [
         "The quick brown fox jumps over the lazy dog"
@@ -52,9 +56,10 @@ def test_wrapped_text():
 
 
 def test_tab_alignment():
+    pytest.skip()
     reference = 'tab_align.png'
     device = dummy()
-    term = terminal(device, font=test_font, animate=False)
+    term = terminal(device, animate=False)
 
     assert_text(device, term, reference, [
         "1\t32\t999",
@@ -63,9 +68,10 @@ def test_tab_alignment():
 
 
 def test_control_chars():
+    pytest.skip()
     reference = 'control_chars.png'
     device = dummy()
-    term = terminal(device, font=test_font, animate=False)
+    term = terminal(device, animate=False)
 
     assert_text(device, term, reference, [
         'foo\rbar\bspam\teggs\n\nham and cheese on rye'
@@ -73,9 +79,10 @@ def test_control_chars():
 
 
 def test_scrolling():
+    pytest.skip()
     reference = 'scroll_text.png'
     device = dummy()
-    term = terminal(device, font=test_font, animate=False)
+    term = terminal(device,  animate=False)
 
     assert_text(device, term, reference, [
         "it oozed over the blackness, and heard Harris's sleepy voice asking "
@@ -87,9 +94,10 @@ def test_scrolling():
 
 
 def test_alt_colors():
+    pytest.skip()
     reference = 'alt_colors.png'
     device = dummy()
-    term = terminal(device, font=test_font, color="blue", bgcolor="grey", animate=False)
+    term = terminal(device, color="blue", bgcolor="grey", animate=False)
 
     assert_text(device, term, reference, [
         "blue on grey"
@@ -97,9 +105,10 @@ def test_alt_colors():
 
 
 def test_ansi_colors():
+    pytest.skip()
     reference = 'ansi_colors.png'
     device = dummy()
-    term = terminal(device, font=test_font, animate=False)
+    term = terminal(device, animate=False)
 
     assert_text(device, term, reference, [
         "hello \033[31mworld\033[0m ansi colors here!",
@@ -109,9 +118,10 @@ def test_ansi_colors():
 
 
 def test_ansi_colors_wrapped():
+    pytest.skip()
     reference = 'ansi_colors_wrapped.png'
     device = dummy()
-    term = terminal(device, font=test_font, word_wrap=True, animate=False)
+    term = terminal(device, word_wrap=True, animate=False)
 
     assert_text(device, term, reference, [
         "hello \033[31mworld\033[0m ansi colors\t\033[32mwrap\033[0m\t?",
@@ -121,9 +131,10 @@ def test_ansi_colors_wrapped():
 
 
 def test_ansi_colors_scroll():
+    pytest.skip()
     reference = 'ansi_colors_scroll.png'
     device = dummy()
-    term = terminal(device, font=test_font, word_wrap=True, animate=False)
+    term = terminal(device, word_wrap=True, animate=False)
 
     assert_text(device, term, reference, [
         "hello \033[31mworld\033[0m ansi colors\t\033[32mwrap\033[0m\t?",
@@ -134,6 +145,7 @@ def test_ansi_colors_scroll():
 
 
 def test_accented_charset():
+    pytest.skip()
     reference = 'accented_charset.png'
     unicode_font = get_reference_font('DejaVuSans.ttf')
     device = dummy()
Index: luma.core/tests/test_sevensegment.py
===================================================================
--- luma.core.orig/tests/test_sevensegment.py
+++ luma.core/tests/test_sevensegment.py
@@ -131,4 +131,4 @@ def test_setter_getter():
         seg.text = "1.61803398875"
         assert str(seg.text) == "1.61803398875"
 
-        assert_identical_image(reference, device.image, img_path)
+#assert_identical_image(reference, device.image, img_path)
Index: luma.core/tests/test_viewport.py
===================================================================
--- luma.core.orig/tests/test_viewport.py
+++ luma.core/tests/test_viewport.py
@@ -11,7 +11,7 @@ helpers.
 import time
 
 from PIL import Image
-
+import pytest
 from luma.core.device import dummy
 from luma.core.render import canvas
 from luma.core.virtual import range_overlap, hotspot, snapshot, viewport
@@ -108,6 +108,7 @@ def test_snapshot_last_updated():
 
 
 def test_viewport_set_position():
+    pytest.skip()
     img_path = get_reference_image('set_position.png')
 
     with open(img_path, 'rb') as p:
@@ -141,7 +142,7 @@ def test_viewport_hotspot():
         virtual.set_position((28, 30))
         virtual.remove_hotspot(widget, (19, 56))
 
-        assert_identical_image(reference, device.image, img_path)
+#assert_identical_image(reference, device.image, img_path)
 
 
 def test_viewport_dithering():
Index: luma.core/tests/helpers.py
===================================================================
--- luma.core.orig/tests/helpers.py
+++ luma.core/tests/helpers.py
@@ -59,7 +59,7 @@ def get_reference_pillow_font(fname):
 
 
 # font used in (most) tests
-test_font = get_reference_pillow_font('courB08.pil')
+#test_font = get_reference_pillow_font('courB08.pil')
 
 
 def get_spidev():
Index: luma.core/tests/test_canvas.py
===================================================================
--- luma.core.orig/tests/test_canvas.py
+++ luma.core/tests/test_canvas.py
@@ -14,10 +14,11 @@ from PIL import Image
 from luma.core.device import dummy
 from luma.core.render import canvas
 
-from helpers import get_reference_image, assert_identical_image, test_font
+from helpers import get_reference_image, assert_identical_image
 
 
 def test_canvas_background():
+    pytest.skip()
     img_path = get_reference_image('background.png')
     with open(get_reference_image('dither.png'), 'rb') as p1:
         with open(img_path, 'rb') as p2:
@@ -28,8 +29,8 @@ def test_canvas_background():
             with canvas(device, background=bgnd) as draw:
                 draw.rectangle((20, 15, device.width - 20, device.height - 15),
                                fill='black', outline='white')
-                draw.text((36, 22), 'Background', fill='white', font=test_font)
-                draw.text((52, 32), 'Test', fill='white', font=test_font)
+                draw.text((36, 22), 'Background', fill='white')
+                draw.text((52, 32), 'Test', fill='white')
 
             assert_identical_image(reference, device.image, img_path)
 
Index: luma.core/tests/baseline_data.py
===================================================================
--- luma.core.orig/tests/baseline_data.py
+++ luma.core/tests/baseline_data.py
@@ -3,8 +3,6 @@
 # Copyright (c) 2017-2024 Richard Hull and contributors
 # See LICENSE.rst for details.
 
-from helpers import test_font
-
 
 def primitives(device, draw):
     padding = 2
@@ -22,5 +20,5 @@ def primitives(device, draw):
     draw.line((x, bottom, x + shape_width, top), fill="yellow")
     draw.line((x, top, x + shape_width, bottom), fill="yellow")
     x += shape_width + padding
-    draw.text((x, top), 'Hello', font=test_font, fill="cyan")
-    draw.text((x, top + 20), 'World!', font=test_font, fill="purple")
+    draw.text((x, top), 'Hello', fill="cyan")
+    draw.text((x, top + 20), 'World!', fill="purple")
