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

Skip to content

Commit a96b83d

Browse files
authored
Merge pull request #16933 from anntzer/toolmanager
Add tests for toolmanager.
2 parents d06a3df + f2bd383 commit a96b83d

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

lib/matplotlib/backend_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ def _mouse_move(self, event):
992992
class ToolHelpBase(ToolBase):
993993
description = 'Print tool list, shortcuts and description'
994994
default_keymap = mpl.rcParams['keymap.help']
995-
image = 'help.png'
995+
image = 'help'
996996

997997
@staticmethod
998998
def format_shortcut(key_sequence):
564 Bytes
Loading

lib/matplotlib/tests/test_backends_interactive.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import importlib
22
import importlib.util
3+
import json
34
import os
45
import signal
56
import subprocess
@@ -60,6 +61,7 @@ def _get_testable_interactive_backends():
6061
_test_script = """\
6162
import importlib
6263
import importlib.util
64+
import json
6365
import sys
6466
from unittest import TestCase
6567
@@ -70,6 +72,8 @@ def _get_testable_interactive_backends():
7072
"webagg.open_in_browser": False,
7173
"webagg.port_retries": 1,
7274
})
75+
if len(sys.argv) >= 2: # Second argument is json-encoded rcParams.
76+
rcParams.update(json.loads(sys.argv[1]))
7377
backend = plt.rcParams["backend"].lower()
7478
assert_equal = TestCase().assertEqual
7579
assert_raises = TestCase().assertRaises
@@ -122,10 +126,14 @@ def check_alt_backend(alt_backend):
122126

123127

124128
@pytest.mark.parametrize("backend", _get_testable_interactive_backends())
129+
@pytest.mark.parametrize("toolbar", ["toolbar2", "toolmanager"])
125130
@pytest.mark.flaky(reruns=3)
126-
def test_interactive_backend(backend):
131+
def test_interactive_backend(backend, toolbar):
132+
if backend == "macosx" and toolbar == "toolmanager":
133+
pytest.skip("toolmanager is not implemented for macosx.")
127134
proc = subprocess.run(
128-
[sys.executable, "-c", _test_script],
135+
[sys.executable, "-c", _test_script,
136+
json.dumps({"toolbar": toolbar})],
129137
env={**os.environ, "MPLBACKEND": backend}, timeout=_test_timeout,
130138
stdout=subprocess.PIPE, universal_newlines=True)
131139
if proc.returncode:

matplotlibrc.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
#backend_fallback: True
9393

9494
#interactive: False
95-
#toolbar: toolbar2 # {None, toolbar2}
95+
#toolbar: toolbar2 # {None, toolbar2, toolmanager}
9696
#timezone: UTC # a pytz timezone string, e.g., US/Central or Europe/Paris
9797

9898

0 commit comments

Comments
 (0)