-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
TST: Skip tests that use a large amount of memory by default #31007
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
8b5ae9d to
a3edc5c
Compare
|
Hmm, looking at |
|
I propose to delete The test tries to confirm that visible == False returns early. It does so by creating large data, that should produce a noticable delay when being processed. |
By cutting the grid by one-tenth in each dimension, this cuts memory usage from 1.0GiB to 65.2MiB. I temporarily added an assert in `_ImageBase._make_image` to confirm that the interpolation stage did correctly switch to 'rgba' as well.
This test tries to check for slowdowns, which is inherently flaky (as noted by the comment), and we don't check `set_visible` for other artists.
a3edc5c to
548930e
Compare
|
Okay, I removed that test and reduced the memory usage for |
60e2f0c to
7c98478
Compare
|
So it turns out that |
According to memray, these tests use fairly large amounts of memory: - lib/matplotlib/tests/test_simplification.py::test_throw_rendering_complexity_exceeded: 2.2GiB - lib/matplotlib/tests/test_agg.py::test_chunksize_fails: 2.0GiB - lib/matplotlib/tests/test_image.py::test_large_image[png-col-16777216-2\\*\\*24 rows-upper]: 1.0GiB - lib/matplotlib/tests/test_image.py::test_large_image[png-col-16777216-2\\*\\*24 rows-lower]: 1.0GiB - lib/matplotlib/tests/test_image.py::test_large_image[png-row-8388608-2\\*\\*23 columns-lower]: 537.8MiB - lib/matplotlib/tests/test_image.py::test_large_image[png-row-8388608-2\\*\\*23 columns-upper]: 537.8MiB The next closest tests use just 216MiB, then 145.5MiB, etc. and then the majority under 100MiB. If you're unlucky, with 4-way xdist you might use upwards of 6GiB RAM if you get all these on separate processes. The above tests are all fairly low-level checks for Agg renderer limits that are not likely to change often, so skip them by default unless on CI.
7c98478 to
fddba89
Compare
| Some tests may use a large amount of memory (>0.5GiB); to enable those tests, set the | ||
| environment variable ``MPL_TEST_HIGH_MEMORY``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to generalize to "expensive tests"? This could include runtime as well as memory.
The 14 slowest tests together take 120s.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we have too many that take long; I guess just the sphinx docs one, maybe?
PR summary
According to memray, these tests use fairly large amounts of memory:
lib/matplotlib/tests/test_image.py::test_downsample_interpolation_stage[png]: 1.0GiBlib/matplotlib/tests/test_lines.py::test_invisible_Line_rendering: 822.0MiBThe next closest tests use just 216MiB, then 145.5MiB, etc. and then the majority under 100MiB.
If you're unlucky, with 4-way xdist you might use upwards of 6GiB RAM if you get all these on separate processes.
The above tests are all fairly low-level checks for Agg renderer limits that are not likely to change often, so skip them by default unless on CI.
PR checklist