Skip to content

Commit

Permalink
Backport PR matplotlib#28925: TST: handle change in pytest.importorsk…
Browse files Browse the repository at this point in the history
…ip behavior
  • Loading branch information
tacaswell authored and QuLogic committed Oct 18, 2024
1 parent 5270a2c commit 1f1901b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
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

0 comments on commit 1f1901b

Please sign in to comment.