##// END OF EJS Templates
Isolate tests so state doesn't leak to other tests
Ian Thomas -
Show More
@@ -258,6 +258,29 b' class TestPylabSwitch(object):'
258 assert gui == "qt"
258 assert gui == "qt"
259 assert s.pylab_gui_select == "qt"
259 assert s.pylab_gui_select == "qt"
260
260
261 @dec.skipif(not pt._matplotlib_manages_backends())
262 def test_backend_module_name_case_sensitive(self):
263 # Matplotlib backend names are case insensitive unless explicitly specified using
264 # "module://some_module.some_name" syntax which are case sensitive for mpl >= 3.9.1
265 all_lowercase = "module://matplotlib_inline.backend_inline"
266 some_uppercase = "module://matplotlib_inline.Backend_inline"
267 mpl3_9_1 = matplotlib.__version_info__ >= (3, 9, 1)
268
269 s = self.Shell()
270 s.enable_matplotlib(all_lowercase)
271 if mpl3_9_1:
272 with pytest.raises(RuntimeError):
273 s.enable_matplotlib(some_uppercase)
274 else:
275 s.enable_matplotlib(some_uppercase)
276
277 s.run_line_magic("matplotlib", all_lowercase)
278 if mpl3_9_1:
279 with pytest.raises(RuntimeError):
280 s.run_line_magic("matplotlib", some_uppercase)
281 else:
282 s.run_line_magic("matplotlib", some_uppercase)
283
261
284
262 def test_no_gui_backends():
285 def test_no_gui_backends():
263 for k in ['agg', 'svg', 'pdf', 'ps']:
286 for k in ['agg', 'svg', 'pdf', 'ps']:
@@ -350,27 +373,3 b' def test_backend_entry_point():'
350 def test_backend_unknown():
373 def test_backend_unknown():
351 with pytest.raises(RuntimeError if pt._matplotlib_manages_backends() else KeyError):
374 with pytest.raises(RuntimeError if pt._matplotlib_manages_backends() else KeyError):
352 pt.find_gui_and_backend("name-does-not-exist")
375 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