From 9e4479b6fda301d3794563571e161160554cbb25 2012-04-19 18:56:42 From: Jonathan March Date: 2012-04-19 18:56:42 Subject: [PATCH] Merge pull request #1631 from punchagan/qapplication-exists-test-error TST: QApplication doesn't quit early enough with PySide In both tests which create a QApplication, first check whether one already exists, and if so use it. This is an issue with PySide, which unlike PyQt does not delete the QApplication when expected. Closes #1628 --- diff --git a/IPython/frontend/qt/console/tests/test_console_widget.py b/IPython/frontend/qt/console/tests/test_console_widget.py index c3fc9b2..6cc5b04 100644 --- a/IPython/frontend/qt/console/tests/test_console_widget.py +++ b/IPython/frontend/qt/console/tests/test_console_widget.py @@ -14,7 +14,9 @@ class TestConsoleWidget(unittest.TestCase): def setUpClass(cls): """ Create the application for the test case. """ - cls._app = QtGui.QApplication([]) + cls._app = QtGui.QApplication.instance() + if cls._app is None: + cls._app = QtGui.QApplication([]) cls._app.setQuitOnLastWindowClosed(False) @classmethod diff --git a/IPython/frontend/qt/console/tests/test_kill_ring.py b/IPython/frontend/qt/console/tests/test_kill_ring.py index 8b05405..e75a86b 100644 --- a/IPython/frontend/qt/console/tests/test_kill_ring.py +++ b/IPython/frontend/qt/console/tests/test_kill_ring.py @@ -14,7 +14,9 @@ class TestKillRing(unittest.TestCase): def setUpClass(cls): """ Create the application for the test case. """ - cls._app = QtGui.QApplication([]) + cls._app = QtGui.QApplication.instance() + if cls._app is None: + cls._app = QtGui.QApplication([]) cls._app.setQuitOnLastWindowClosed(False) @classmethod