##// END OF EJS Templates
Convert matplotlib gui name in enable_gui
Ian Thomas -
Show More
@@ -27,7 +27,11 b' from IPython.core.inputtransformer import InputTransformer'
27 from IPython.core import interactiveshell
27 from IPython.core import interactiveshell
28 from IPython.core.oinspect import OInfo
28 from IPython.core.oinspect import OInfo
29 from IPython.testing.decorators import (
29 from IPython.testing.decorators import (
30 skipif, skip_win32, onlyif_unicode_paths, onlyif_cmds_exist,
30 skipif,
31 skip_win32,
32 onlyif_unicode_paths,
33 onlyif_cmds_exist,
34 skip_if_not_osx,
31 )
35 )
32 from IPython.testing import tools as tt
36 from IPython.testing import tools as tt
33 from IPython.utils.process import find_cmd
37 from IPython.utils.process import find_cmd
@@ -144,7 +148,6 b' class InteractiveShellTestCase(unittest.TestCase):'
144 f = IPython.core.formatters.PlainTextFormatter()
148 f = IPython.core.formatters.PlainTextFormatter()
145 f([Spam(),Spam()])
149 f([Spam(), Spam()])
146
150
147
148 def test_future_flags(self):
151 def test_future_flags(self):
149 """Check that future flags are used for parsing code (gh-777)"""
152 """Check that future flags are used for parsing code (gh-777)"""
150 ip.run_cell('from __future__ import barry_as_FLUFL')
153 ip.run_cell('from __future__ import barry_as_FLUFL')
@@ -1199,3 +1202,20 b' class TestShowTracebackAttack(unittest.TestCase):'
1199 assert result.result is None
1202 assert result.result is None
1200 assert isinstance(result.error_in_exec, AssertionError)
1203 assert isinstance(result.error_in_exec, AssertionError)
1201 assert str(result.error_in_exec) == "This should not raise an exception"
1204 assert str(result.error_in_exec) == "This should not raise an exception"
1205
1206
1207 @skip_if_not_osx
1208 def test_enable_gui_osx():
1209 simple_prompt = ip.simple_prompt
1210 ip.simple_prompt = False
1211
1212 ip.enable_gui("osx")
1213 assert ip.active_eventloop == "osx"
1214 ip.enable_gui()
1215
1216 # The following line fails for IPython <= 8.25.0
1217 ip.enable_gui("macosx")
1218 assert ip.active_eventloop == "osx"
1219 ip.enable_gui()
1220
1221 ip.simple_prompt = simple_prompt
@@ -943,6 +943,11 b' class TerminalInteractiveShell(InteractiveShell):'
943 active_eventloop: Optional[str] = None
943 active_eventloop: Optional[str] = None
944
944
945 def enable_gui(self, gui: Optional[str] = None) -> None:
945 def enable_gui(self, gui: Optional[str] = None) -> None:
946 if gui:
947 from ..core.pylabtools import _convert_gui_from_matplotlib
948
949 gui = _convert_gui_from_matplotlib(gui)
950
946 if self.simple_prompt is True and gui is not None:
951 if self.simple_prompt is True and gui is not None:
947 print(
952 print(
948 f'Cannot install event loop hook for "{gui}" when running with `--simple-prompt`.'
953 f'Cannot install event loop hook for "{gui}" when running with `--simple-prompt`.'
@@ -147,10 +147,13 b' skip_osx = skipif(sys.platform == \'darwin\',"This test does not run under OS X")'
147
147
148
148
149 # Decorators to skip tests if not on specific platforms.
149 # Decorators to skip tests if not on specific platforms.
150 skip_if_not_win32 = skipif(sys.platform != 'win32',
150 skip_if_not_win32 = skipif(sys.platform != "win32", "This test only runs under Windows")
151 "This test only runs under Windows")
151 skip_if_not_linux = skipif(
152 skip_if_not_linux = skipif(not sys.platform.startswith('linux'),
152 not sys.platform.startswith("linux"), "This test only runs under Linux"
153 "This test only runs under Linux")
153 )
154 skip_if_not_osx = skipif(
155 not sys.platform.startswith("darwin"), "This test only runs under macOS"
156 )
154
157
155 _x11_skip_cond = (sys.platform not in ('darwin', 'win32') and
158 _x11_skip_cond = (sys.platform not in ('darwin', 'win32') and
156 os.environ.get('DISPLAY', '') == '')
159 os.environ.get('DISPLAY', '') == '')
General Comments 0
You need to be logged in to leave comments. Login now