Skip to content

Commit b67f018

Browse files
authored
Merge pull request #8382 from radarhere/lint
2 parents dacfbbd + 88b3265 commit b67f018

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

Tests/test_image.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,22 +1086,17 @@ def test_overrun(self, path: str) -> None:
10861086
valgrind pytest -qq Tests/test_image.py::TestImage::test_overrun | grep decode.c
10871087
"""
10881088
with Image.open(os.path.join("Tests/images", path)) as im:
1089-
try:
1089+
with pytest.raises(OSError) as e:
10901090
im.load()
1091-
pytest.fail()
1092-
except OSError as e:
1093-
buffer_overrun = str(e) == "buffer overrun when reading image file"
1094-
truncated = "image file is truncated" in str(e)
1091+
buffer_overrun = str(e.value) == "buffer overrun when reading image file"
1092+
truncated = "image file is truncated" in str(e.value)
10951093

1096-
assert buffer_overrun or truncated
1094+
assert buffer_overrun or truncated
10971095

10981096
def test_fli_overrun2(self) -> None:
10991097
with Image.open("Tests/images/fli_overrun2.bin") as im:
1100-
try:
1098+
with pytest.raises(OSError, match="buffer overrun when reading image file"):
11011099
im.seek(1)
1102-
pytest.fail()
1103-
except OSError as e:
1104-
assert str(e) == "buffer overrun when reading image file"
11051100

11061101
def test_exit_fp(self) -> None:
11071102
with Image.new("L", (1, 1)) as im:

Tests/test_imageshow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def test_ipythonviewer() -> None:
115115
test_viewer = viewer
116116
break
117117
else:
118-
pytest.fail()
118+
pytest.fail("IPythonViewer not found")
119119

120120
im = hopper()
121121
assert test_viewer.show(im) == 1

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ lint.ignore = [
125125
"PT007", # pytest-parametrize-values-wrong-type
126126
"PT011", # pytest-raises-too-broad
127127
"PT012", # pytest-raises-with-multiple-statements
128-
"PT016", # pytest-fail-without-message
129128
"PT017", # pytest-assert-in-except
130129
"PYI026", # flake8-pyi: typing.TypeAlias added in Python 3.10
131130
"PYI034", # flake8-pyi: typing.Self added in Python 3.11

0 commit comments

Comments
 (0)