Skip to content

Backport PR #28925 on branch v3.9.x (TST: handle change in pytest.importorskip behavior) #28947

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/matplotlib/tests/test_rcparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion lib/mpl_toolkits/mplot3d/tests/test_axes3d.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import functools
import itertools
import platform
import sys

import pytest

Expand Down Expand Up @@ -114,7 +115,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
Expand Down
Loading