Closed
Description
Bug summary
I have an older conda environment with ipython 8.8.0, and this test seems to be failing. Also when building on Fedora Rawhide with ipython 8.24.0, I see the failure as well. I'm not sure why this passes (but fails with my environments) with the minimum versions in CI.
cc @ianthomas23
Code for reproduction
$ pytest lib/matplotlib/tests/test_backend_qt.py::test_ipython
Actual outcome
________ test_ipython ________
def test_ipython():
from matplotlib.testing import ipython_in_subprocess
> ipython_in_subprocess("qt", "QtAgg", "qtagg")
lib/matplotlib/tests/test_backend_qt.py:381:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
requested_backend_or_gui_framework = 'qt', expected_backend_old_ipython = 'QtAgg', expected_backend_new_ipython = 'qtagg'
def ipython_in_subprocess(
requested_backend_or_gui_framework,
expected_backend_old_ipython, # IPython < 8.24
expected_backend_new_ipython, # IPython >= 8.24
):
import pytest
IPython = pytest.importorskip("IPython")
if sys.platform == "win32":
pytest.skip("Cannot change backend running IPython in subprocess on Windows")
if (IPython.version_info[:3] == (8, 24, 0) and
requested_backend_or_gui_framework == "osx"):
pytest.skip("Bug using macosx backend in IPython 8.24.0 fixed in 8.24.1")
if IPython.version_info[:2] >= (8, 24):
expected_backend = expected_backend_new_ipython
else:
# This code can be removed when Python 3.12, the latest version supported by
# IPython < 8.24, reaches end-of-life in late 2028.
expected_backend = expected_backend_old_ipython
code = ("import matplotlib as mpl, matplotlib.pyplot as plt;"
"fig, ax=plt.subplots(); ax.plot([1, 3, 2]); mpl.get_backend()")
proc = subprocess_run_for_testing(
[
"ipython",
"--no-simple-prompt",
f"--matplotlib={requested_backend_or_gui_framework}",
"-c", code,
],
check=True,
capture_output=True,
)
> assert proc.stdout.strip() == f"Out[1]: '{expected_backend}'"
E AssertionError
lib/matplotlib/testing/__init__.py:217: AssertionError
Expected outcome
The test passes.
Additional information
If I print out the proc.stdout
, then I get Out[1]: 'Qt5Agg'
; the test appears to be looking for 'qtagg', instead?
Operating system
Fedora 39/Rawhide
Matplotlib Version
main (3ee509d)
Installation
git checkout
Metadata
Metadata
Assignees
Labels
No labels