##// 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 27 from IPython.core import interactiveshell
28 28 from IPython.core.oinspect import OInfo
29 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 36 from IPython.testing import tools as tt
33 37 from IPython.utils.process import find_cmd
@@ -144,7 +148,6 b' class InteractiveShellTestCase(unittest.TestCase):'
144 148 f = IPython.core.formatters.PlainTextFormatter()
145 149 f([Spam(),Spam()])
146 150
147
148 151 def test_future_flags(self):
149 152 """Check that future flags are used for parsing code (gh-777)"""
150 153 ip.run_cell('from __future__ import barry_as_FLUFL')
@@ -1199,3 +1202,20 b' class TestShowTracebackAttack(unittest.TestCase):'
1199 1202 assert result.result is None
1200 1203 assert isinstance(result.error_in_exec, AssertionError)
1201 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 943 active_eventloop: Optional[str] = None
944 944
945 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 951 if self.simple_prompt is True and gui is not None:
947 952 print(
948 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 149 # Decorators to skip tests if not on specific platforms.
150 skip_if_not_win32 = skipif(sys.platform != 'win32',
151 "This test only runs under Windows")
152 skip_if_not_linux = skipif(not sys.platform.startswith('linux'),
153 "This test only runs under Linux")
150 skip_if_not_win32 = skipif(sys.platform != "win32", "This test only runs under Windows")
151 skip_if_not_linux = skipif(
152 not sys.platform.startswith("linux"), "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 158 _x11_skip_cond = (sys.platform not in ('darwin', 'win32') and
156 159 os.environ.get('DISPLAY', '') == '')
General Comments 0
You need to be logged in to leave comments. Login now