Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitd8f3016

Browse files
tacaswellmeeseeksmachine
authored andcommitted
Backport PR#28205: TST: Fix tests with older versions of ipython
1 parent4db5ac9 commitd8f3016

File tree

5 files changed

+11
-16
lines changed

5 files changed

+11
-16
lines changed

‎.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
-os:ubuntu-20.04
6161
python-version:3.9
6262
# One CI run tests ipython/matplotlib-inline before backend mapping moved to mpl
63-
extra-requirements:'-r requirements/testing/extra.txt "ipython<8.24" "matplotlib-inline<0.1.7"'
63+
extra-requirements:'-r requirements/testing/extra.txt "ipython==7.19" "matplotlib-inline<0.1.7"'
6464
CFLAGS:"-fno-lto"# Ensure that disabling LTO works.
6565
# https://github.com/matplotlib/matplotlib/pull/26052#issuecomment-1574595954
6666
# https://www.riverbankcomputing.com/pipermail/pyqt/2023-November/045606.html

‎lib/matplotlib/testing/__init__.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,7 @@ def _has_tex_package(package):
179179
returnFalse
180180

181181

182-
defipython_in_subprocess(
183-
requested_backend_or_gui_framework,
184-
expected_backend_old_ipython,# IPython < 8.24
185-
expected_backend_new_ipython,# IPython >= 8.24
186-
):
182+
defipython_in_subprocess(requested_backend_or_gui_framework,all_expected_backends):
187183
importpytest
188184
IPython=pytest.importorskip("IPython")
189185

@@ -194,12 +190,12 @@ def ipython_in_subprocess(
194190
requested_backend_or_gui_framework=="osx"):
195191
pytest.skip("Bug using macosx backend in IPython 8.24.0 fixed in 8.24.1")
196192

197-
ifIPython.version_info[:2]>= (8,24):
198-
expected_backend=expected_backend_new_ipython
199-
else:
200-
# This code can be removed when Python 3.12, the latest version supported by
201-
# IPython < 8.24, reaches end-of-life in late 2028.
202-
expected_backend=expected_backend_old_ipython
193+
# This code can be removed when Python 3.12, the latest version supported
194+
# by IPython < 8.24, reaches end-of-life in late 2028.
195+
formin_version,backendinall_expected_backends.items():
196+
ifIPython.version_info[:2]>=min_version:
197+
expected_backend=backend
198+
break
203199

204200
code= ("import matplotlib as mpl, matplotlib.pyplot as plt;"
205201
"fig, ax=plt.subplots(); ax.plot([1, 3, 2]); mpl.get_backend()")

‎lib/matplotlib/testing/__init__.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,5 @@ def _check_for_pgf(texsystem: str) -> bool: ...
4949
def_has_tex_package(package:str)->bool: ...
5050
defipython_in_subprocess(
5151
requested_backend_or_gui_framework:str,
52-
expected_backend_old_ipython:str,
53-
expected_backend_new_ipython:str,
52+
all_expected_backends:dict[tuple[int,int],str],
5453
)->None: ...

‎lib/matplotlib/tests/test_backend_macosx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ def new_choose_save_file(title, directory, filename):
4848

4949
deftest_ipython():
5050
frommatplotlib.testingimportipython_in_subprocess
51-
ipython_in_subprocess("osx","MacOSX","macosx")
51+
ipython_in_subprocess("osx",{(8,24):"macosx",(7,0):"MacOSX"})

‎lib/matplotlib/tests/test_backend_qt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,4 +376,4 @@ def custom_handler(signum, frame):
376376

377377
deftest_ipython():
378378
frommatplotlib.testingimportipython_in_subprocess
379-
ipython_in_subprocess("qt","QtAgg","qtagg")
379+
ipython_in_subprocess("qt",{(8,24):"qtagg", (8,15):"QtAgg",(7,0):"Qt5Agg"})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp