From bb489d7307445ada13427dba95aa8f47a5409c80 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Wed, 2 Oct 2024 16:27:12 -0400 Subject: [PATCH 1/2] TST: handle change in pytest.importorskip behavior It now warns if the module is found, but fails to import (rather than not existing and raising ModuleNotFound). --- lib/matplotlib/tests/test_rcparams.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/tests/test_rcparams.py b/lib/matplotlib/tests/test_rcparams.py index 25ae258ffcbb..0aa3ec0ba603 100644 --- a/lib/matplotlib/tests/test_rcparams.py +++ b/lib/matplotlib/tests/test_rcparams.py @@ -5,6 +5,7 @@ from unittest import mock from cycler import cycler, Cycler +from packaging.version import parse as parse_version import pytest import matplotlib as mpl @@ -539,7 +540,12 @@ def test_backend_fallback_headless(tmp_path): sys.platform == "linux" and not _c_internal_utils.xdisplay_is_valid(), reason="headless") def test_backend_fallback_headful(tmp_path): - pytest.importorskip("tkinter") + if parse_version(pytest.__version__) >= parse_version('8.2.0'): + pytest_kwargs = dict(exc_type=ImportError) + else: + pytest_kwargs = {} + + pytest.importorskip("tkinter", **pytest_kwargs) env = {**os.environ, "MPLBACKEND": "", "MPLCONFIGDIR": str(tmp_path)} backend = subprocess_run_for_testing( [sys.executable, "-c", From c5e33874d00a40ae72865418b640056ef74de862 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 3 Oct 2024 16:41:19 -0400 Subject: [PATCH 2/2] TST: Increase test_axes3d_primary_views tolerance on all macOS Apparently, Azure updated from macOS 12 to 14, which caused the change in results outside of the Intel->ARM change. --- lib/mpl_toolkits/mplot3d/tests/test_axes3d.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/mpl_toolkits/mplot3d/tests/test_axes3d.py b/lib/mpl_toolkits/mplot3d/tests/test_axes3d.py index 0afcae99c980..d97637636f10 100644 --- a/lib/mpl_toolkits/mplot3d/tests/test_axes3d.py +++ b/lib/mpl_toolkits/mplot3d/tests/test_axes3d.py @@ -1,6 +1,7 @@ import functools import itertools import platform +import sys import pytest @@ -115,7 +116,7 @@ def test_axes3d_repr(): @mpl3d_image_comparison(['axes3d_primary_views.png'], style='mpl20', - tol=0.05 if platform.machine() == "arm64" else 0) + tol=0.05 if sys.platform == "darwin" else 0) def test_axes3d_primary_views(): # (elev, azim, roll) views = [(90, -90, 0), # XY