Skip to content
Snippets Groups Projects
Commit d3debe2a authored by Martyn Gigg's avatar Martyn Gigg
Browse files

Skip Jupyter tests on Python 3 for Qt5

They currently segfault when importing readline. This seems
to be fixed for IPython 5

Starting it without stdin under Python 3 seems to cause
a segfault in readline.
parent 307bcef2
No related branches found
No related tags found
No related merge requests found
......@@ -17,18 +17,26 @@
from __future__ import (absolute_import)
# system imports
import sys
import unittest
# third-party library imports
import IPython
from qtpy import QT_VERSION
# local package imports
from mantidqt.widgets.jupyterconsole import InProcessJupyterConsole
from mantidqt.utils.qt.testing import requires_qapp
PRE_IPY5_PY3_QT5 = (sys.version_info.major == 3 and IPython.version_info[0] < 5 and int(QT_VERSION[0]) == 5)
SKIP_REASON = "Segfault within readline for IPython < 5 and Python 3"
@requires_qapp
class InProcessJupyterConsoleTest(unittest.TestCase):
@unittest.skipIf(PRE_IPY5_PY3_QT5, SKIP_REASON)
def test_construction_raises_no_errors(self):
widget = InProcessJupyterConsole()
self.assertTrue(hasattr(widget, "kernel_manager"))
......@@ -36,16 +44,19 @@ class InProcessJupyterConsoleTest(unittest.TestCase):
self.assertTrue(len(widget.banner) > 0)
del widget
@unittest.skipIf(PRE_IPY5_PY3_QT5, SKIP_REASON)
def test_construction_with_banner_replaces_default(self):
widget = InProcessJupyterConsole(banner="Hello!")
self.assertEquals("Hello!", widget.banner)
del widget
@unittest.skipIf(PRE_IPY5_PY3_QT5, SKIP_REASON)
def test_construction_with_startup_code_adds_to_banner_and_executes(self):
widget = InProcessJupyterConsole(startup_code="x = 1")
self.assertTrue("x = 1" in widget.banner)
self.assertEquals(1, widget.kernel_manager.kernel.shell.user_ns['x'])
del widget
if __name__ == '__main__':
unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment