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 af9d83f

Browse filesBrowse files
make assertion visible to pytest
1 parent 7c1b0b4 commit af9d83f
Copy full SHA for af9d83f

File tree

Expand file treeCollapse file tree

1 file changed

+12
-7
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+12
-7
lines changed

‎lib/matplotlib/tests/test_backends_interactive.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_backends_interactive.py
+12-7Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -336,10 +336,6 @@ def _test_figure_leak():
336336
if len(sys.argv) >= 2: # Second argument is json-encoded rcParams.
337337
rcParams.update(json.loads(sys.argv[1]))
338338

339-
# We can't yet directly identify the leak
340-
# so test with a memory growth threshold
341-
ACCEPTABLE_MEMORY_LEAKAGE = 1_000_000
342-
343339
# Warmup cycle, this reasonably allocates a lot
344340
p = psutil.Process()
345341
fig = plt.figure()
@@ -351,14 +347,23 @@ def _test_figure_leak():
351347
fig = plt.figure()
352348
plt.close(fig)
353349
growth = p.memory_full_info().uss - mem
354-
assert growth < ACCEPTABLE_MEMORY_LEAKAGE, "Memory leakage too high"
350+
351+
print(growth)
355352

356353

357354
@pytest.mark.parametrize("env", _get_testable_interactive_backends())
358355
def test_figure_leak_20490(env):
359356
pytest.importorskip("psutil", reason="psutil needed to run this test")
360-
subprocess.run(
357+
358+
# We can't yet directly identify the leak
359+
# so test with a memory growth threshold
360+
acceptable_memory_leakage = 1_000_000
361+
362+
result = subprocess.run(
361363
[sys.executable, "-c",
362364
inspect.getsource(_test_figure_leak) + "\n_test_figure_leak()"],
363365
env={**os.environ, "SOURCE_DATE_EPOCH": "0", **env},
364-
timeout=_test_timeout, check=True,)
366+
timeout=_test_timeout, stdout=subprocess.PIPE, check=True)
367+
368+
growth = int(result.stdout)
369+
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.