From e3e71346bbb2ae85728b2ab60b81f7ff3ae814c0 2012-04-19 04:55:06 From: Puneeth Chaganti Date: 2012-04-19 04:55:06 Subject: [PATCH] TST: QApplication doesn't quit early enough with PySide. Fixes #1628. This commits adds a check in tests, to see if there's already a QApplication and use it, instead of creating a new one each time. --- 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