Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed duplicate test #6082

Merged
merged 1 commit into from
Feb 22, 2022
Merged

Removed duplicate test #6082

merged 1 commit into from
Feb 22, 2022

Conversation

radarhere
Copy link
Member

#6035 added a test covering the situation when RAQM is requested but unavailable.

Pillow/Tests/test_imagefont.py

Lines 1027 to 1037 in 9e6537d

def test_raqm_missing_warning(monkeypatch):
monkeypatch.setattr(ImageFont.core, "HAVE_RAQM", False)
with pytest.warns(UserWarning) as record:
font = ImageFont.truetype(
FONT_PATH, FONT_SIZE, layout_engine=ImageFont.Layout.RAQM
)
assert font.layout_engine == ImageFont.Layout.BASIC
assert str(record[-1].message) == (
"Raqm layout was requested, but Raqm is not available. "
"Falling back to basic layout."
)

Turns out, we already had a test for this.

def test_unavailable_layout_engine(self):
have_raqm = ImageFont.core.HAVE_RAQM
ImageFont.core.HAVE_RAQM = False
try:
ttf = ImageFont.truetype(
FONT_PATH, FONT_SIZE, layout_engine=ImageFont.Layout.RAQM
)
finally:
ImageFont.core.HAVE_RAQM = have_raqm
assert ttf.layout_engine == ImageFont.Layout.BASIC

This PR removes the original. The new one appears better as it makes use of monkeypatching.

@hugovk hugovk merged commit bd96420 into python-pillow:main Feb 22, 2022
@radarhere radarhere deleted the duplicate branch February 22, 2022 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants