Skip to content

Commit e98d502

Browse files
turnipseasonksunden
authored andcommitted
Changed the test to skip when IPython can't be imported and use _run_helper for the subprocess.
1 parent b1a0f20 commit e98d502

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/matplotlib/tests/test_backends_interactive.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -623,16 +623,20 @@ def test_blitting_events(env):
623623
assert 0 < ndraws < 5
624624

625625

626+
def _fallback_check():
627+
import IPython.core.interactiveshell as ipsh
628+
import matplotlib.pyplot
629+
ipsh.InteractiveShell.instance()
630+
matplotlib.pyplot.figure()
631+
632+
626633
def test_fallback_to_different_backend():
634+
pytest.importorskip("IPython")
627635
import subprocess
628636
# Runs the process that caused the GH issue 23770
629637
# making sure that this doesn't crash
630638
# since we're supposed to be switching to a different backend instead.
631-
response = subprocess.run(["python", "-c",
632-
"import IPython.core.interactiveshell as ipsh; "
633-
"ipsh.InteractiveShell.instance(); "
634-
"import matplotlib.pyplot; "
635-
"matplotlib.pyplot.figure()"], check=True)
639+
response = _run_helper(_fallback_check, timeout=_test_timeout)
636640
assert response != subprocess.CalledProcessError
637641

638642

0 commit comments

Comments
 (0)