Skip to content

Commit fb52ed0

Browse files
radarheregounthar
authored andcommitted
Instead of skipping all riscv64 tests, only skip timeout-based tests
Signed-off-by: Bruno Verachten <gounthar@gmail.com>
1 parent 85c36d1 commit fb52ed0

10 files changed

Lines changed: 22 additions & 20 deletions

File tree

.github/workflows/wheels.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ jobs:
137137
CIBW_BUILD: ${{ matrix.build }}
138138
CIBW_ENABLE: cpython-prerelease pypy
139139
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ matrix.manylinux }}
140-
CIBW_TEST_SKIP: ${{ matrix.cibw_arch == 'riscv64' && '*-linux_riscv64' || '' }}
141140
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macosx_deployment_target }}
142141

143142
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1

Tests/helper.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,11 @@ def assert_tuple_approx_equal(
163163
pytest.fail(msg + ": " + repr(actuals) + " != " + repr(targets))
164164

165165

166-
def timeout_unless_slower_valgrind(timeout: float) -> pytest.MarkDecorator:
167-
if "PILLOW_VALGRIND_TEST" in os.environ:
166+
def timeout_unless_slower(timeout: float) -> pytest.MarkDecorator:
167+
if (
168+
"PILLOW_VALGRIND_TEST" in os.environ
169+
or os.environ.get("AUDITWHEEL_ARCH") == "riscv64"
170+
):
168171
return pytest.mark.pil_noop_mark()
169172
return pytest.mark.timeout(timeout)
170173

Tests/test_file_eps.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
is_win32,
1717
mark_if_feature_version,
1818
skip_unless_feature,
19-
timeout_unless_slower_valgrind,
19+
timeout_unless_slower,
2020
)
2121

2222
HAS_GHOSTSCRIPT = EpsImagePlugin.has_ghostscript()
@@ -411,7 +411,7 @@ def test_emptyline() -> None:
411411
assert image.format == "EPS"
412412

413413

414-
@timeout_unless_slower_valgrind(5)
414+
@timeout_unless_slower(5)
415415
@pytest.mark.parametrize(
416416
"test_file",
417417
["Tests/images/eps/timeout-d675703545fee17acab56e5fec644c19979175de.eps"],

Tests/test_file_fli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
assert_image_equal,
1212
assert_image_equal_tofile,
1313
is_pypy,
14-
timeout_unless_slower_valgrind,
14+
timeout_unless_slower,
1515
)
1616

1717
# created as an export of a palette image from Gimp2.6
@@ -196,7 +196,7 @@ def test_seek() -> None:
196196
"Tests/images/timeout-bff0a9dc7243a8e6ede2408d2ffa6a9964698b87.fli",
197197
],
198198
)
199-
@timeout_unless_slower_valgrind(3)
199+
@timeout_unless_slower(3)
200200
def test_timeouts(test_file: str) -> None:
201201
with open(test_file, "rb") as f:
202202
with Image.open(f) as im:

Tests/test_file_jpeg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
is_win32,
3232
mark_if_feature_version,
3333
skip_unless_feature,
34-
timeout_unless_slower_valgrind,
34+
timeout_unless_slower,
3535
)
3636

3737
ElementTree: ModuleType | None
@@ -1048,7 +1048,7 @@ def test_save_xmp(self, tmp_path: Path) -> None:
10481048
with pytest.raises(ValueError):
10491049
im.save(f, xmp=b"1" * 65505)
10501050

1051-
@timeout_unless_slower_valgrind(1)
1051+
@timeout_unless_slower(1)
10521052
def test_eof(self, monkeypatch: pytest.MonkeyPatch) -> None:
10531053
# Even though this decoder never says that it is finished
10541054
# the image should still end when there is no new data

Tests/test_file_pdf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
hopper,
1818
mark_if_feature_version,
1919
skip_unless_feature,
20-
timeout_unless_slower_valgrind,
20+
timeout_unless_slower,
2121
)
2222

2323

@@ -344,7 +344,7 @@ def test_pdf_append_to_bytesio() -> None:
344344
assert len(f.getvalue()) > initial_size
345345

346346

347-
@timeout_unless_slower_valgrind(1)
347+
@timeout_unless_slower(1)
348348
@pytest.mark.parametrize("newline", (b"\r", b"\n"))
349349
def test_redos(newline: bytes) -> None:
350350
malicious = b" trailer<<>>" + newline * 3456

Tests/test_file_tiff.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
hopper,
2929
is_pypy,
3030
is_win32,
31-
timeout_unless_slower_valgrind,
31+
timeout_unless_slower,
3232
)
3333

3434
ElementTree: ModuleType | None
@@ -1015,7 +1015,7 @@ def test_string_dimension(self) -> None:
10151015
with pytest.raises(OSError):
10161016
im.load()
10171017

1018-
@timeout_unless_slower_valgrind(6)
1018+
@timeout_unless_slower(6)
10191019
@pytest.mark.filterwarnings("ignore:Truncated File Read")
10201020
def test_timeout(self, monkeypatch: pytest.MonkeyPatch) -> None:
10211021
with Image.open("Tests/images/timeout-6646305047838720") as im:
@@ -1028,7 +1028,7 @@ def test_timeout(self, monkeypatch: pytest.MonkeyPatch) -> None:
10281028
"Tests/images/oom-225817ca0f8c663be7ab4b9e717b02c661e66834.tif",
10291029
],
10301030
)
1031-
@timeout_unless_slower_valgrind(2)
1031+
@timeout_unless_slower(2)
10321032
def test_oom(self, test_file: str) -> None:
10331033
with pytest.raises(UnidentifiedImageError):
10341034
with pytest.warns(UserWarning, match="Corrupt EXIF data"):

Tests/test_image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
is_win32,
3535
mark_if_feature_version,
3636
skip_unless_feature,
37-
timeout_unless_slower_valgrind,
37+
timeout_unless_slower,
3838
)
3939

4040
ElementTree: ModuleType | None
@@ -577,7 +577,7 @@ def test_check_size(self) -> None:
577577
i = Image.new("RGB", [1, 1])
578578
assert isinstance(i.size, tuple)
579579

580-
@timeout_unless_slower_valgrind(0.75)
580+
@timeout_unless_slower(0.75)
581581
@pytest.mark.parametrize("size", ((0, 100000000), (100000000, 0)))
582582
def test_empty_image(self, size: tuple[int, int]) -> None:
583583
Image.new("RGB", size)

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, timeout_unless_slower_valgrind
10+
from .helper import assert_image_equal_tofile, timeout_unless_slower
1111

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

8080

81-
@timeout_unless_slower_valgrind(4)
81+
@timeout_unless_slower(4)
8282
def test_oom() -> None:
8383
glyph = struct.pack(
8484
">hhhhhhhhhh", 1, 0, -32767, -32767, 32767, 32767, -32767, -32767, 32767, 32767

Tests/test_imagemorph.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, ImageMorph, _imagingmorph
99

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

1212

1313
def string_to_img(image_string: str) -> Image.Image:
@@ -266,7 +266,7 @@ def test_unknown_pattern() -> None:
266266
@pytest.mark.parametrize(
267267
"pattern", ("a pattern with a syntax error", "4:(" + "X" * 30000)
268268
)
269-
@timeout_unless_slower_valgrind(1)
269+
@timeout_unless_slower(1)
270270
def test_pattern_syntax_error(pattern: str) -> None:
271271
# Arrange
272272
lb = ImageMorph.LutBuilder(op_name="corner")

0 commit comments

Comments
 (0)