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 39c345c

Browse filesBrowse files
committed
TST: Remove memory leak test
It is flaky, and our memory "limit" is pretty much arbitrary. Testing with `tools/memleak.py` shows that memory usage generally rises and only stabilizes close to 200 figures, while this test only does a warmup of 2 figures. Waiting for equilibrium would take too long for a general test, so we might move this to a weekly job later.
1 parent 3ad0bc5 commit 39c345c
Copy full SHA for 39c345c

File tree

Expand file treeCollapse file tree

1 file changed

+0
-60
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+0
-60
lines changed

‎lib/matplotlib/tests/test_backends_interactive.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_backends_interactive.py
-60Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -627,66 +627,6 @@ def test_blitting_events(env):
627627
assert 0 < ndraws < 5
628628

629629

630-
# The source of this function gets extracted and run in another process, so it
631-
# must be fully self-contained.
632-
def _test_figure_leak():
633-
import gc
634-
import sys
635-
636-
import psutil
637-
from matplotlib import pyplot as plt
638-
# Second argument is pause length, but if zero we should skip pausing
639-
t = float(sys.argv[1])
640-
p = psutil.Process()
641-
642-
# Warmup cycle, this reasonably allocates a lot
643-
for _ in range(2):
644-
fig = plt.figure()
645-
if t:
646-
plt.pause(t)
647-
plt.close(fig)
648-
mem = p.memory_info().rss
649-
gc.collect()
650-
651-
for _ in range(5):
652-
fig = plt.figure()
653-
if t:
654-
plt.pause(t)
655-
plt.close(fig)
656-
gc.collect()
657-
growth = p.memory_info().rss - mem
658-
659-
print(growth)
660-
661-
662-
# TODO: "0.1" memory threshold could be reduced 10x by fixing tkagg
663-
@pytest.mark.skipif(sys.platform == "win32",
664-
reason="appveyor tests fail; gh-22988 suggests reworking")
665-
@pytest.mark.parametrize("env", _get_testable_interactive_backends())
666-
@pytest.mark.parametrize("time_mem", [(0.0, 2_000_000), (0.1, 30_000_000)])
667-
def test_figure_leak_20490(env, time_mem, request):
668-
pytest.importorskip("psutil", reason="psutil needed to run this test")
669-
670-
# We haven't yet directly identified the leaks so test with a memory growth
671-
# threshold.
672-
pause_time, acceptable_memory_leakage = time_mem
673-
if env["MPLBACKEND"] == "wx":
674-
pytest.skip("wx backend is deprecated; tests failed on appveyor")
675-
676-
if env["MPLBACKEND"] == "macosx":
677-
request.node.add_marker(pytest.mark.xfail(reason="macosx backend is leaky"))
678-
679-
if env["MPLBACKEND"] == "tkagg" and sys.platform == "darwin":
680-
acceptable_memory_leakage += 11_000_000
681-
682-
result = _run_helper(
683-
_test_figure_leak, str(pause_time),
684-
timeout=_test_timeout, extra_env=env)
685-
686-
growth = int(result.stdout)
687-
assert growth <= acceptable_memory_leakage
688-
689-
690630
def _impl_test_interactive_timers():
691631
# A timer with <1 millisecond gets converted to int and therefore 0
692632
# milliseconds, which the mac framework interprets as singleshot.

0 commit comments

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