From f194dc690440f10dab2bd01178a0765f802ae87c Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Mon, 23 May 2022 15:47:39 +0200 Subject: [PATCH] Reuse subprocess_run_helper in test_pylab_integration. It's basically here for that purpose... --- lib/matplotlib/tests/test_pyplot.py | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/lib/matplotlib/tests/test_pyplot.py b/lib/matplotlib/tests/test_pyplot.py index 6f9ddd5ccf21..d0d28381a5c6 100644 --- a/lib/matplotlib/tests/test_pyplot.py +++ b/lib/matplotlib/tests/test_pyplot.py @@ -1,6 +1,5 @@ import difflib import numpy as np -import os import subprocess import sys from pathlib import Path @@ -371,23 +370,14 @@ def test_set_current_axes_on_subfigure(): def test_pylab_integration(): - pytest.importorskip("IPython") - subprocess.run( - [ - sys.executable, - "-m", - "IPython", - "--pylab", - "-c", - ";".join(( - "import matplotlib.pyplot as plt", - "assert plt._REPL_DISPLAYHOOK == plt._ReplDisplayHook.IPYTHON", - )), - ], - env={**os.environ, "SOURCE_DATE_EPOCH": "0"}, + IPython = pytest.importorskip("IPython") + mpl.testing.subprocess_run_helper( + IPython.start_ipython, + "--pylab", + "-c", + ";".join(( + "import matplotlib.pyplot as plt", + "assert plt._REPL_DISPLAYHOOK == plt._ReplDisplayHook.IPYTHON", + )), timeout=60, - check=True, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - universal_newlines=True, )