10000 Add tests for toolmanager. · matplotlib/matplotlib@229dbfc · GitHub
[go: up one dir, main page]

Skip to content

Commit 229dbfc

Browse files
committed
Add tests for toolmanager.
... and fix Help tool for tk (it needs a gif icon, generated (like the other gifs) with `convert -antialias -geometry 24x24 help.svg help.gif`). ... and also edit the matplotlibrc template to mention its availability.
1 parent d9b722f commit 229dbfc

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

lib/matplotlib/backend_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ def _mouse_move(self, event):
10301030
class ToolHelpBase(ToolBase):
10311031
description = 'Print tool list, shortcuts and description'
10321032
default_keymap = mpl.rcParams['keymap.help']
1033-
image = 'help.png'
1033+
image = 'help'
10341034

10351035
@staticmethod
10361036
def format_shortcut(key_sequence):
564 Bytes
Loading

lib/matplotlib/tests/test_backends_interactive.py

Lines changed: 8 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
@@ -57,6 +58,7 @@ def _get_testable_interactive_backends():
5758
_test_script = """\
5859
import importlib
5960
import importlib.util
61+
import json
6062
import sys
6163
from unittest import TestCase
6264
@@ -67,6 +69,8 @@ def _get_testable_interactive_backends():
6769
"webagg.open_in_browser": False,
6870
"webagg.port_retries": 1,
6971
})
72+
if len(sys.argv) >= 2: # Second argument is json-encoded rcParams.
73+
rcParams.update(json.loads(sys.argv[1]))
7074
backend = plt.rcParams["backend"].lower()
7175
assert_equal = TestCase().assertEqual
7276
assert_raises = TestCase().assertRaises
@@ -119,10 +123,12 @@ def check_alt_backend(alt_backend):
119123

120124

121125
@pytest.mark.parametrize("backend", _get_testable_interactive_backends())
126+
@pytest.mark.parametrize("toolbar", ["toolbar2", "toolmanager"])
122127
@pytest.mark.flaky(reruns=3)
123-
def test_interactive_backend(backend):
128+
def test_interactive_backend(backend, toolbar):
124129
proc = subprocess.run(
125-
[sys.executable, "-c", _test_script],
130+
[sys.executable, "-c", _test_script,
131+
json.dumps({"toolbar": toolbar})],
126132
env={**os.environ, "MPLBACKEND": backend}, timeout=_test_timeout,
127133
stdout=subprocess.PIPE, universal_newlines=True)
128134
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)
0