Skip to content

Commit d3b755d

Browse files
akxradarhere
andauthored
Improve test stability (#9933)
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
1 parent ab7e054 commit d3b755d

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

Tests/helper.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,14 @@ def mark_if_feature_version(
207207
return pytest.mark.pil_noop_mark()
208208

209209

210+
def is_pypy() -> bool:
211+
return sys.implementation.name == "pypy"
212+
213+
210214
@pytest.mark.skipif(sys.platform.startswith("win32"), reason="Requires Unix or macOS")
215+
# Per https://stackoverflow.com/a/29007723/51685, due to JIT compilation,
216+
# RSS utilization is known to grow in PyPy.
217+
@pytest.mark.skipif(is_pypy(), reason="max RSS utilization is not stable on PyPy")
211218
class PillowLeakTestCase:
212219
# requires unix/macOS
213220
iterations = 100 # count
@@ -332,7 +339,3 @@ def is_ppc64le() -> bool:
332339

333340
def is_win32() -> bool:
334341
return sys.platform.startswith("win32")
335-
336-
337-
def is_pypy() -> bool:
338-
return sys.implementation.name == "pypy"

Tests/test_image.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,9 @@ def test_check_size(self) -> None:
572572
assert isinstance(i.size, tuple)
573573

574574
@timeout_unless_slower_valgrind(0.75)
575-
@pytest.mark.parametrize("size", ((0, 100000000), (100000000, 0)))
575+
@pytest.mark.parametrize(
576+
"size", ((0, 10_000_000), (10_000_000, 0)), ids=("tall", "wide")
577+
)
576578
def test_empty_image(self, size: tuple[int, int]) -> None:
577579
Image.new("RGB", size)
578580

0 commit comments

Comments
 (0)