Skip to content

Commit f054046

Browse files
committed
Do not check timeout on valgrind
1 parent cd6a212 commit f054046

File tree

5 files changed

+16
-8
lines changed

5 files changed

+16
-8
lines changed

Tests/test_file_eps.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
is_win32,
1616
mark_if_feature_version,
1717
skip_unless_feature,
18+
timeout_unless_slower_valgrind,
1819
)
1920

2021
HAS_GHOSTSCRIPT = EpsImagePlugin.has_ghostscript()
@@ -398,7 +399,7 @@ def test_emptyline() -> None:
398399
assert image.format == "EPS"
399400

400401

401-
@pytest.mark.timeout(timeout=5)
402+
@timeout_unless_slower_valgrind(5)
402403
@pytest.mark.parametrize(
403404
"test_file",
404405
["Tests/images/eps/timeout-d675703545fee17acab56e5fec644c19979175de.eps"],

Tests/test_file_fli.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77

88
from PIL import FliImagePlugin, Image, ImageFile
99

10-
from .helper import assert_image_equal, assert_image_equal_tofile, is_pypy
10+
from .helper import (
11+
assert_image_equal,
12+
assert_image_equal_tofile,
13+
is_pypy,
14+
timeout_unless_slower_valgrind,
15+
)
1116

1217
# created as an export of a palette image from Gimp2.6
1318
# save as...-> hopper.fli, default options.
@@ -189,7 +194,7 @@ def test_seek() -> None:
189194
"Tests/images/timeout-bff0a9dc7243a8e6ede2408d2ffa6a9964698b87.fli",
190195
],
191196
)
192-
@pytest.mark.timeout(timeout=3)
197+
@timeout_unless_slower_valgrind(3)
193198
def test_timeouts(test_file: str) -> None:
194199
with open(test_file, "rb") as f:
195200
with Image.open(f) as im:

Tests/test_file_jpeg.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
is_win32,
3333
mark_if_feature_version,
3434
skip_unless_feature,
35+
timeout_unless_slower_valgrind,
3536
)
3637

3738
ElementTree: ModuleType | None
@@ -1033,7 +1034,7 @@ def test_save_xmp(self, tmp_path: Path) -> None:
10331034
with pytest.raises(ValueError):
10341035
im.save(f, xmp=b"1" * 65505)
10351036

1036-
@pytest.mark.timeout(timeout=1)
1037+
@timeout_unless_slower_valgrind(1)
10371038
def test_eof(self, monkeypatch: pytest.MonkeyPatch) -> None:
10381039
# Even though this decoder never says that it is finished
10391040
# the image should still end when there is no new data

Tests/test_file_tiff.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
hopper,
2727
is_pypy,
2828
is_win32,
29+
timeout_unless_slower_valgrind,
2930
)
3031

3132
ElementTree: ModuleType | None
@@ -988,7 +989,7 @@ def test_string_dimension(self) -> None:
988989
with pytest.raises(OSError):
989990
im.load()
990991

991-
@pytest.mark.timeout(6)
992+
@timeout_unless_slower_valgrind(6)
992993
@pytest.mark.filterwarnings("ignore:Truncated File Read")
993994
def test_timeout(self, monkeypatch: pytest.MonkeyPatch) -> None:
994995
with Image.open("Tests/images/timeout-6646305047838720") as im:
@@ -1001,7 +1002,7 @@ def test_timeout(self, monkeypatch: pytest.MonkeyPatch) -> None:
10011002
"Tests/images/oom-225817ca0f8c663be7ab4b9e717b02c661e66834.tif",
10021003
],
10031004
)
1004-
@pytest.mark.timeout(2)
1005+
@timeout_unless_slower_valgrind(2)
10051006
def test_oom(self, test_file: str) -> None:
10061007
with pytest.raises(UnidentifiedImageError):
10071008
with pytest.warns(UserWarning):

Tests/test_imagefontpil.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from PIL import Image, ImageDraw, ImageFont, _util, features
99

10-
from .helper import assert_image_equal_tofile
10+
from .helper import assert_image_equal_tofile, timeout_unless_slower_valgrind
1111

1212
fonts = [ImageFont.load_default_imagefont()]
1313
if not features.check_module("freetype2"):
@@ -72,7 +72,7 @@ def test_decompression_bomb() -> None:
7272
font.getmask("A" * 1_000_000)
7373

7474

75-
@pytest.mark.timeout(4)
75+
@timeout_unless_slower_valgrind(4)
7676
def test_oom() -> None:
7777
glyph = struct.pack(
7878
">hhhhhhhhhh", 1, 0, -32767, -32767, 32767, 32767, -32767, -32767, 32767, 32767

0 commit comments

Comments
 (0)