Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6dd935b

Browse files
authored
Merge pull request #8691 from anntzer/fix-interactive-backends-testing
Fix skipif in interactive backends test.
2 parents d52bdc3 + 524f867 commit 6dd935b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/matplotlib/tests/test_backends_interactive.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
# an undesirable input hook).
2020

2121

22-
def _get_available_backends():
22+
def _get_testable_interactive_backends():
2323
return [
24-
pytest.mark.skipif(sys.version_info < (3,)
25-
or importlib.util.find_spec(module_name) is None,
26-
reason="Could not import {!r}".format(module_name))(
27-
backend)
24+
pytest.mark.skipif(
25+
not os.environ.get("DISPLAY")
26+
or sys.version_info < (3,)
27+
or importlib.util.find_spec(module_name) is None,
28+
reason="No $DISPLAY or could not import {!r}".format(module_name))(
29+
backend)
2830
for module_name, backend in [
2931
("PyQt5", "qt5agg"),
3032
("tkinter", "tkagg"),
@@ -41,9 +43,7 @@ def _get_available_backends():
4143
"""
4244

4345

44-
@pytest.mark.skipif("DISPLAY" not in os.environ,
45-
reason="The DISPLAY environment variable is not set.")
46-
@pytest.mark.parametrize("backend", _get_available_backends())
46+
@pytest.mark.parametrize("backend", _get_testable_interactive_backends())
4747
def test_backend(backend):
4848
environ = os.environ.copy()
4949
environ["MPLBACKEND"] = backend

0 commit comments

Comments
 (0)