From 24cec47aa72ab243f7df3d71f0f6306c13d73d02 2018-04-11 10:34:13 From: Thomas Kluyver Date: 2018-04-11 10:34:13 Subject: [PATCH] Backport PR #11087: FIX: Remove the non-interactive backends from pylabtools.backend2gui --- diff --git a/IPython/core/pylabtools.py b/IPython/core/pylabtools.py index ca7344e..a1932d8 100644 --- a/IPython/core/pylabtools.py +++ b/IPython/core/pylabtools.py @@ -48,6 +48,9 @@ backend2gui['CocoaAgg'] = 'osx' # And some backends that don't need GUI integration del backend2gui['nbAgg'] del backend2gui['agg'] +del backend2gui['svg'] +del backend2gui['pdf'] +del backend2gui['ps'] del backend2gui['module://ipykernel.pylab.backend_inline'] #----------------------------------------------------------------------------- diff --git a/IPython/core/tests/test_pylabtools.py b/IPython/core/tests/test_pylabtools.py index aa9d16b..0edd2c2 100644 --- a/IPython/core/tests/test_pylabtools.py +++ b/IPython/core/tests/test_pylabtools.py @@ -106,7 +106,7 @@ def test_select_figure_formats_kwargs(): f = formatter.lookup_by_type(Figure) cell = f.__closure__[0].cell_contents nt.assert_equal(cell, kwargs) - + # check that the formatter doesn't raise fig = plt.figure() ax = fig.add_subplot(1,1,1) @@ -151,7 +151,7 @@ class TestPylabSwitch(object): class Shell(InteractiveShell): def enable_gui(self, gui): pass - + def setup(self): import matplotlib def act_mpl(backend): @@ -245,3 +245,7 @@ class TestPylabSwitch(object): nt.assert_equal(gui, 'qt') nt.assert_equal(s.pylab_gui_select, 'qt') + +def test_no_gui_backends(): + for k in ['agg', 'svg', 'pdf', 'ps']: + assert k not in pt.backend2gui