##// END OF EJS Templates
Don't force matplotlib backend names to be lowercase
Ian Thomas -
Show More
@@ -100,7 +100,7 b' class PylabMagics(Magics):'
100 % _list_matplotlib_backends_and_gui_loops()
100 % _list_matplotlib_backends_and_gui_loops()
101 )
101 )
102 else:
102 else:
103 gui, backend = self.shell.enable_matplotlib(args.gui.lower() if isinstance(args.gui, str) else args.gui)
103 gui, backend = self.shell.enable_matplotlib(args.gui)
104 self._show_matplotlib_backend(args.gui, backend)
104 self._show_matplotlib_backend(args.gui, backend)
105
105
106 @skip_doctest
106 @skip_doctest
@@ -350,3 +350,27 b' def test_backend_entry_point():'
350 def test_backend_unknown():
350 def test_backend_unknown():
351 with pytest.raises(RuntimeError if pt._matplotlib_manages_backends() else KeyError):
351 with pytest.raises(RuntimeError if pt._matplotlib_manages_backends() else KeyError):
352 pt.find_gui_and_backend("name-does-not-exist")
352 pt.find_gui_and_backend("name-does-not-exist")
353
354
355 @dec.skipif(not pt._matplotlib_manages_backends())
356 def test_backend_module_name_case_sensitive():
357 # Matplotlib backend names are case insensitive unless explicitly specified using
358 # "module://some_module.some_name" syntax which are case sensitive for mpl >= 3.9.1
359 all_lowercase = "module://matplotlib_inline.backend_inline"
360 some_uppercase = "module://matplotlib_inline.Backend_inline"
361 ip = get_ipython()
362 mpl3_9_1 = matplotlib.__version_info__ >= (3, 9, 1)
363
364 ip.enable_matplotlib(all_lowercase)
365 if mpl3_9_1:
366 with pytest.raises(RuntimeError):
367 ip.enable_matplotlib(some_uppercase)
368 else:
369 ip.enable_matplotlib(some_uppercase)
370
371 ip.run_line_magic("matplotlib", all_lowercase)
372 if mpl3_9_1:
373 with pytest.raises(RuntimeError):
374 ip.run_line_magic("matplotlib", some_uppercase)
375 else:
376 ip.run_line_magic("matplotlib", some_uppercase)
General Comments 0
You need to be logged in to leave comments. Login now