def test_issue157(self): """Verify that we get the error class name back - issue #157 .. seealso:: https://github.com/AIFDR/inasafe/issues/121 """ try: bbox_intersection('aoeu', 'oaeu', []) except BoundingBoxError, e: myMessage = getExceptionWithStacktrace(e, theHtml=False) assert 'BoundingBoxError : Western' in myMessage, myMessage
def test_issue157(self): """Verify that we get the error class name back - issue #157 .. seealso:: https://github.com/AIFDR/inasafe/issues/121 """ try: bbox_intersection('aoeu', 'oaeu', []) except VerificationError, e: myMessage = getExceptionWithStacktrace(e, html=False) assert 'VerificationError : Western' in myMessage, myMessage
def test_stacktrace_html(self): """Stack traces can be caught and rendered as html """ # This is about general exception handling, so ok to use catch-all # pylint: disable=W0703 try: bbox_intersection('aoeu', 'oaeu', []) except Exception, e: # Display message and traceback myMessage = getExceptionWithStacktrace(e, theHtml=False) #print myMessage assert str(e) in myMessage assert 'line' in myMessage assert 'File' in myMessage myMessage = getExceptionWithStacktrace(e, theHtml=True) assert str(e) in myMessage assert '<pre id="traceback"' in myMessage assert 'line' in myMessage assert 'File' in myMessage
def test_stacktrace_html(self): """Stack traces can be caught and rendered as html """ # This is about general exception handling, so ok to use catch-all # pylint: disable=W0703 try: bbox_intersection('aoeu', 'oaeu', []) except Exception, e: # Display message and traceback myMessage = getExceptionWithStacktrace(e, html=False) #print myMessage assert str(e) in myMessage assert 'line' in myMessage assert 'File' in myMessage myMessage = getExceptionWithStacktrace(e, html=True) assert str(e) in myMessage assert '<pre id="traceback"' in myMessage assert 'line' in myMessage assert 'File' in myMessage
def accept(self): """Automatic slot executed when the ok button is pressed. It will write out the keywords for the layer that is active. Args: None Returns: None. Raises: no exceptions explicitly raised.""" myKeywords = self.getKeywords() try: self.keywordIO.writeKeywords(self.layer, myKeywords) except InaSAFEError, e: QtGui.QMessageBox.warning(self, self.tr('InaSAFE'), ((self.tr('An error was encountered when saving the keywords:\n' '%s' % str(getExceptionWithStacktrace(e))))))
def accept(self): """Automatic slot executed when the ok button is pressed. It will write out the keywords for the layer that is active. Args: None Returns: None. Raises: no exceptions explicitly raised.""" myKeywords = self.getKeywords() try: self.keywordIO.writeKeywords(self.layer, myKeywords) except InaSAFEError, e: QtGui.QMessageBox.warning(self, self.tr('InaSAFE'), ((self.tr( 'An error was encountered when saving the keywords:\n' '%s' % str(getExceptionWithStacktrace(e))))))