コード例 #1
0
    def test_trait_exception_handler_can_access_exception(self):
        """ Tests if trait exception handlers can access the traceback of the exception.
        """
        from traits import trait_notifiers

        def _handle_exception(obj, name, old, new):
            self.assertIsNotNone(sys.exc_info()[0])

        ge = GenerateFailingEvents()
        try:
            trait_notifiers.push_exception_handler(
                _handle_exception, reraise_exceptions=False, main=True
            )
            ge.trait_set(name="John Cleese")
        finally:
            trait_notifiers.pop_exception_handler()
コード例 #2
0
ファイル: test_listeners.py プロジェクト: UdayaR/traits
    def test_trait_exception_handler_can_access_exception(self):
        """ Tests if trait exception handlers can access the traceback of the exception.
        """
        import traceback

        from traits import trait_notifiers
        def _handle_exception(obj,name,old,new):
            self.assertIsNotNone(sys.exc_info()[0])
        ge = GenerateFailingEvents()
        try:
            trait_notifiers.push_exception_handler(
                _handle_exception,
                reraise_exceptions=False,
                main=True
            )
            ge.trait_set(name='John Cleese')
        finally:
            trait_notifiers.pop_exception_handler()
コード例 #3
0
 def tearDown(self):
     trait_notifiers.pop_exception_handler()
コード例 #4
0
ファイル: testing.py プロジェクト: enthought/qt_binder
 def tearDown(self):
     pop_exception_handler()
     GuiTestAssistant.tearDown(self)
コード例 #5
0
 def tearDown(self):
     trait_notifiers.pop_exception_handler()
コード例 #6
0
ファイル: testing.py プロジェクト: Qt-Widgets/qt_binder
 def tearDown(self):
     pop_exception_handler()
     GuiTestAssistant.tearDown(self)