mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-03 05:04:24 +03:00
Use tempfile.NamedTemporaryFile
This commit is contained in:
parent
dbe979d032
commit
547832fd59
|
@ -461,14 +461,15 @@ def test_free_type_font_get_mask(font: ImageFont.FreeTypeFont) -> None:
|
|||
assert mask.size == (108, 13)
|
||||
|
||||
|
||||
def test_load_when_image_not_found(tmp_path: Path) -> None:
|
||||
tmpfile = tmp_path / "file.font"
|
||||
tmpfile.write_bytes(b"")
|
||||
tempfile = str(tmpfile)
|
||||
def test_load_when_image_not_found() -> None:
|
||||
with tempfile.NamedTemporaryFile(delete=False) as tmp:
|
||||
pass
|
||||
with pytest.raises(OSError) as e:
|
||||
ImageFont.load(tempfile)
|
||||
ImageFont.load(tmp.name)
|
||||
|
||||
root = os.path.splitext(tempfile)[0]
|
||||
os.unlink(tmp.name)
|
||||
|
||||
root = os.path.splitext(tmp.name)[0]
|
||||
assert str(e.value) == f"cannot find glyph data file {root}.{{gif|pbm|png}}"
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user