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 bbbe8d2

Browse filesBrowse files
committed
MNT: simplify the sub-process test code
1 parent 3f14f74 commit bbbe8d2
Copy full SHA for bbbe8d2

File tree

1 file changed

+11
-5
lines changed
Filter options

1 file changed

+11
-5
lines changed

‎lib/matplotlib/tests/test_backend_tk.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_backend_tk.py
+11-5Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,19 @@ def _isolated_tk_test(success_count, func=None):
2828
if "MPL_TEST_ESCAPE_HATCH" in os.environ:
2929
return func
3030

31+
@pytest.mark.skipif(
32+
importlib.util.find_spec('tkinter'),
33+
reason="missing tkinter"
34+
)
35+
@pytest.mark.skipif(
36+
sys.platform == "linux" and not _c_internal_utils.display_is_valid(),
37+
reason="$DISPLAY and $WAYLAND_DISPLAY are unset"
38+
)
3139
@functools.wraps(func)
3240
def test_func():
33-
if (sys.platform == "linux" and
34-
not _c_internal_utils.display_is_valid()):
35-
pytest.skip("$DISPLAY and $WAYLAND_DISPLAY are unset")
36-
elif not importlib.util.find_spec('tkinter'):
37-
pytest.skip("missing tkinter")
41+
# even if the package exists, may not actually be importable this can
42+
# be the case on some CI systems.
43+
pytest.importorskip('tkinter')
3844
try:
3945
proc = subprocess_run_helper(
4046
func, timeout=_test_timeout,

0 commit comments

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