Skip to content

Commit 8caae87

Browse files
committed
Restored testing of non-TrueType default font
1 parent 1185fb8 commit 8caae87

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Tests/test_font_leaks.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
from __future__ import annotations
22

3-
from PIL import Image, ImageDraw, ImageFont
3+
from PIL import Image, ImageDraw, ImageFont, _util
44

5-
from .helper import PillowLeakTestCase, skip_unless_feature
5+
from .helper import PillowLeakTestCase, features, skip_unless_feature
6+
7+
original_core = ImageFont.core
68

79

810
class TestTTypeFontLeak(PillowLeakTestCase):
@@ -31,5 +33,9 @@ class TestDefaultFontLeak(TestTTypeFontLeak):
3133
mem_limit = 1024 # k
3234

3335
def test_leak(self):
36+
if features.check_module("freetype2"):
37+
ImageFont.core = _util.DeferredError(ImportError)
3438
default_font = ImageFont.load_default()
39+
ImageFont.core = original_core
40+
3541
self._test_font(default_font)

0 commit comments

Comments
 (0)