Skip to content

Commit df1e039

Browse files
authored
Merge pull request #28925 from tacaswell/tst/pytest_tkinter
TST: handle change in pytest.importorskip behavior
2 parents d442ca8 + c5e3387 commit df1e039

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/matplotlib/tests/test_rcparams.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from unittest import mock
66

77
from cycler import cycler, Cycler
8+
from packaging.version import parse as parse_version
89
import pytest
910

1011
import matplotlib as mpl
@@ -539,7 +540,12 @@ def test_backend_fallback_headless(tmp_path):
539540
sys.platform == "linux" and not _c_internal_utils.xdisplay_is_valid(),
540541
reason="headless")
541542
def test_backend_fallback_headful(tmp_path):
542-
pytest.importorskip("tkinter")
543+
if parse_version(pytest.__version__) >= parse_version('8.2.0'):
544+
pytest_kwargs = dict(exc_type=ImportError)
545+
else:
546+
pytest_kwargs = {}
547+
548+
pytest.importorskip("tkinter", **pytest_kwargs)
543549
env = {**os.environ, "MPLBACKEND": "", "MPLCONFIGDIR": str(tmp_path)}
544550
backend = subprocess_run_for_testing(
545551
[sys.executable, "-c",

lib/mpl_toolkits/mplot3d/tests/test_axes3d.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import functools
22
import itertools
33
import platform
4+
import sys
45

56
import pytest
67

@@ -115,7 +116,7 @@ def test_axes3d_repr():
115116

116117

117118
@mpl3d_image_comparison(['axes3d_primary_views.png'], style='mpl20',
118-
tol=0.05 if platform.machine() == "arm64" else 0)
119+
tol=0.05 if sys.platform == "darwin" else 0)
119120
def test_axes3d_primary_views():
120121
# (elev, azim, roll)
121122
views = [(90, -90, 0), # XY

0 commit comments

Comments
 (0)