Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 353aaf9

Browse files
committed
Reuse subprocess_run_helper in test_pylab_integration.
It's basically here for that purpose...
1 parent b31c5ae commit 353aaf9

File tree

2 files changed

+11
-23
lines changed

2 files changed

+11
-23
lines changed

lib/matplotlib/testing/__init__.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def setup():
5252

5353
def subprocess_run_helper(func, *args, timeout, **extra_env):
5454
"""
55-
Run a function in a sub-process
55+
Run a function in a sub-process.
5656
5757
Parameters
5858
----------
@@ -61,12 +61,10 @@ def subprocess_run_helper(func, *args, timeout, **extra_env):
6161
6262
*args : str
6363
Any additional command line arguments to be passed in
64-
the first argument to subprocess.run
64+
the first argument to `subprocess.run`.
6565
6666
**extra_env : Dict[str, str]
67-
Any additional envromental variables to be set for
68-
the subprocess.
69-
67+
Any additional environment variables to be set for the subprocess.
7068
"""
7169
target = func.__name__
7270
module = func.__module__

lib/matplotlib/tests/test_pyplot.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -371,23 +371,13 @@ def test_set_current_axes_on_subfigure():
371371

372372

373373
def test_pylab_integration():
374-
pytest.importorskip("IPython")
375-
subprocess.run(
376-
[
377-
sys.executable,
378-
"-m",
379-
"IPython",
380-
"--pylab",
381-
"-c",
382-
";".join((
383-
"import matplotlib.pyplot as plt",
384-
"assert plt._REPL_DISPLAYHOOK == plt._ReplDisplayHook.IPYTHON",
385-
)),
386-
],
387-
env={**os.environ, "SOURCE_DATE_EPOCH": "0"},
374+
mpl.testing.subprocess_run_helper(
375+
pytest.importorskip("IPython").start_ipython,
376+
"--pylab",
377+
"-c",
378+
";".join((
379+
"import matplotlib.pyplot as plt",
380+
"assert plt._REPL_DISPLAYHOOK == plt._ReplDisplayHook.IPYTHON",
381+
)),
388382
timeout=60,
389-
check=True,
390-
stdout=subprocess.PIPE,
391-
stderr=subprocess.PIPE,
392-
universal_newlines=True,
393383
)

0 commit comments

Comments
 (0)