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 589038c

Browse filesBrowse files
Revert "tune memory leak test"
This reverts commit 2829677
1 parent a082b32 commit 589038c
Copy full SHA for 589038c

File tree

Expand file treeCollapse file tree

1 file changed

+10
-16
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-16
lines changed

‎lib/matplotlib/tests/test_backends_interactive.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_backends_interactive.py
+10-16Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -511,44 +511,38 @@ def _test_figure_leak():
511511

512512
import psutil
513513
from matplotlib import pyplot as plt
514-
515-
flush = sys.argv[1] == "yes"
514+
# Second argument is pause length, but if zero we should skip pausing
515+
t = float(sys.argv[1])
516516
p = psutil.Process()
517517

518518
# Warmup cycle, this reasonably allocates a lot
519519
for _ in range(2):
520520
fig = plt.figure()
521-
if flush:
522-
fig.canvas.flush_events()
521+
if t:
522+
plt.pause(t)
523523
plt.close(fig)
524-
if flush:
525-
fig.canvas.flush_events()
526524
mem = p.memory_info().rss
527525

528526
for _ in range(5):
529527
fig = plt.figure()
530-
if flush:
531-
fig.canvas.flush_events()
528+
if t:
529+
plt.pause(t)
532530
plt.close(fig)
533-
if flush:
534-
fig.canvas.flush_events()
535531
growth = p.memory_info().rss - mem
536532

537533
print(growth)
538534

539535

540536
@pytest.mark.parametrize("env", _get_testable_interactive_backends())
541-
@pytest.mark.parametrize("flush", ["no", "yes"])
542-
def test_figure_leak_20490(env, flush):
537+
@pytest.mark.parametrize("time", ["0.0", "0.1"])
538+
def test_figure_leak_20490(env, time):
543539
pytest.importorskip("psutil", reason="psutil needed to run this test")
544540

545541
# We can't yet directly identify the leak
546542
# so test with a memory growth threshold
547-
acceptable_memory_leakage = 3_000_000
543+
acceptable_memory_leakage = 2_000_000
548544

549-
result = _run_helper(
550-
_test_figure_leak, flush, timeout=_test_timeout, **env
551-
)
545+
result = _run_helper(_test_figure_leak, time, timeout=_test_timeout, **env)
552546

553547
growth = int(result.stdout)
554548
assert growth <= acceptable_memory_leakage

0 commit comments

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