Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dc163ca

Browse filesBrowse files
authored
Combine chunk size tests into one (#23413)
Each one allocates over 2G, and are right next to each other, so when running in parallel, they can combine to OOM very easily. It would be nice to drop the large memory usage entirely, but at least we can remove 5 extra copies of it.
1 parent fe870f5 commit dc163ca
Copy full SHA for dc163ca

File tree

Expand file treeCollapse file tree

1 file changed

+17
-41
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+17
-41
lines changed

‎lib/matplotlib/tests/test_agg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_agg.py
+17-41Lines changed: 17 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from matplotlib import (
1010
collections, path, patheffects, pyplot as plt, transforms as mtransforms,
11-
rcParams)
11+
rcParams, rc_context)
1212
from matplotlib.backends.backend_agg import RendererAgg
1313
from matplotlib.figure import Figure
1414
from matplotlib.image import imread
@@ -275,8 +275,7 @@ def test_draw_path_collection_error_handling():
275275
fig.canvas.draw()
276276

277277

278-
@pytest.fixture
279-
def chunk_limit_setup():
278+
def test_chunksize_fails():
280279
N = 100_000
281280
dpi = 500
282281
w = 5*dpi
@@ -300,54 +299,31 @@ def chunk_limit_setup():
300299
# effectively disable path simplification (but leaving it "on")
301300
p.simplify_threshold = 0
302301

303-
return ra, gc, p, idt
304-
305-
306-
def test_chunksize_hatch_fail(chunk_limit_setup):
307-
ra, gc, p, idt = chunk_limit_setup
308-
309302
gc.set_hatch('/')
310-
311303
with pytest.raises(OverflowError, match='hatched path'):
312304
ra.draw_path(gc, p, idt)
313-
314-
315-
def test_chunksize_rgbFace_fail(chunk_limit_setup):
316-
ra, gc, p, idt = chunk_limit_setup
305+
gc.set_hatch(None)
317306

318307
with pytest.raises(OverflowError, match='filled path'):
319308
ra.draw_path(gc, p, idt, (1, 0, 0))
320309

310+
# Set to zero to disable, currently defaults to 0, but let's be sure.
311+
with rc_context({'agg.path.chunksize': 0}):
312+
with pytest.raises(OverflowError, match='Please set'):
313+
ra.draw_path(gc, p, idt)
321314

322-
def test_chunksize_no_simplify_fail(chunk_limit_setup):
323-
ra, gc, p, idt = chunk_limit_setup
324-
p.should_simplify = False
325-
with pytest.raises(OverflowError, match="should_simplify is False"):
326-
ra.draw_path(gc, p, idt)
315+
# Set big enough that we do not try to chunk.
316+
with rc_context({'agg.path.chunksize': 1_000_000}):
317+
with pytest.raises(OverflowError, match='Please reduce'):
318+
ra.draw_path(gc, p, idt)
327319

320+
# Small enough we will try to chunk, but big enough we will fail to render.
321+
with rc_context({'agg.path.chunksize': 90_000}):
322+
with pytest.raises(OverflowError, match='Please reduce'):
323+
ra.draw_path(gc, p, idt)
328324

329-
def test_chunksize_zero(chunk_limit_setup):
330-
ra, gc, p, idt = chunk_limit_setup
331-
# set to zero to disable, currently defaults to 0, but lets be sure
332-
rcParams['agg.path.chunksize'] = 0
333-
with pytest.raises(OverflowError, match='Please set'):
334-
ra.draw_path(gc, p, idt)
335-
336-
337-
def test_chunksize_too_big_to_chunk(chunk_limit_setup):
338-
ra, gc, p, idt = chunk_limit_setup
339-
# set big enough that we do not try to chunk
340-
rcParams['agg.path.chunksize'] = 1_000_000
341-
with pytest.raises(OverflowError, match='Please reduce'):
342-
ra.draw_path(gc, p, idt)
343-
344-
345-
def test_chunksize_toobig_chunks(chunk_limit_setup):
346-
ra, gc, p, idt = chunk_limit_setup
347-
# small enough we will try to chunk, but big enough we will fail
348-
# to render
349-
rcParams['agg.path.chunksize'] = 90_000
350-
with pytest.raises(OverflowError, match='Please reduce'):
325+
p.should_simplify = False
326+
with pytest.raises(OverflowError, match="should_simplify is False"):
351327
ra.draw_path(gc, p, idt)
352328

353329

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.