def setUp(self):
     self.pre_change_events = []
     self.post_change_events = []
     self.exceptions = []
     trait_notifiers.push_exception_handler(
         lambda obj, name, old, new: None
     )
Example #2
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()
Example #3
0
    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()
 def setUp(self):
     self.exceptions = []
     trait_notifiers.push_exception_handler(self._handle_exception)
Example #5
0
 def setUp(self):
     GuiTestAssistant.setUp(self)
     push_exception_handler(reraise_exceptions=True)
 def setUp(self):
     self.exceptions = []
     trait_notifiers.push_exception_handler(self._handle_exception)
Example #7
0
 def setUp(self):
     GuiTestAssistant.setUp(self)
     push_exception_handler(reraise_exceptions=True)