Skip to content

Improve test stability - #9933

Open
akx wants to merge 2 commits into
python-pillow:mainfrom
akx:macos-pypy-failures
Open

Improve test stability#9933
akx wants to merge 2 commits into
python-pillow:mainfrom
akx:macos-pypy-failures

Conversation

@akx

@akx akx commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

This proposes to fix the PyPy CI flakiness by skipping or adjusting the tests that are observed to be flaky.

  • Leak test cases can't have accurate RSS measurements since PyPy may decide to JIT compile things during a test, and that'll remain in RSS. I linked Armin Rigo's, one of the PyPy head honchos', Stack Overflow comment as rationale.
  • test_empty_image allocated 100,000,000 64-bit ints for row pointers, in the "tall" case, which, I guess, would take a while when there's memory pressure (again, see above; PyPy is known to be memory-hungrier).

EDIT: Oh, the tall case also fails sometimes on vanilla macOS, e.g. here with "FAILED Tests/test_image.py::TestImage::test_empty_image[size0] - Failed: Timeout (>0.75s) from pytest-timeout." Making it allocate 10,000,000 ints instead of 100,000,000 should hopefully help, anyway.

akx added 2 commits August 31, 2026 21:01
The tall case still needs to allocate the row-pointer table `im->image`, which is still roughly 700 megabytes, which evidently can be slow
@akx akx changed the title Don't run certain tests on PyPy Try to avoid PyPy test flakes Aug 31, 2026
@akx akx changed the title Try to avoid PyPy test flakes Try to avoid certain test flakes Sep 1, 2026
@radarhere

Copy link
Copy Markdown
Member

Regarding test_empty_image, see what you think of #9957

@radarhere radarhere changed the title Try to avoid certain test flakes Improve test stability Sep 5, 2026
Comment thread Tests/helper.py

@pytest.mark.skipif(sys.platform.startswith("win32"), reason="Requires Unix or macOS")
# Per https://stackoverflow.com/a/29007723/51685, due to JIT compilation,
# RSS utilization is known to grow so measuring it doesn't make that much sense.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# RSS utilization is known to grow so measuring it doesn't make that much sense.
# RSS utilization is known to grow in PyPy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants