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

Appearance settings

Commit bb489d7

Browse filesBrowse files
tacaswellQuLogic
authored andcommitted
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).
1 parent 54d718e commit bb489d7
Copy full SHA for bb489d7

File tree

Expand file treeCollapse file tree

1 file changed

+7
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-1
lines changed

‎lib/matplotlib/tests/test_rcparams.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_rcparams.py
+7-1Lines changed: 7 additions & 1 deletion
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",

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.