Ejemplo n.º 1
0
 def test_exc(self):
   """Formatting a chained error message."""
   base = ValueError("foo")
   
   expectMsgFirst = "hello\n   caused by ValueError: foo"
   actualFirst = util.exc(base, "hello", AssertionError)
   self.assertEqual(str(actualFirst), expectMsgFirst)
   self.assertEqual(type(actualFirst), AssertionError)
   
   expectMsgSecond = "goodbye\n   caused by AssertionError: " + expectMsgFirst
   actualSecond = util.exc(actualFirst, "goodbye") # use default class
   self.assertEqual(str(actualSecond), expectMsgSecond)
   self.assertEqual(type(actualSecond), Exception)
Ejemplo n.º 2
0
 def read_latest_data(self):
   """Copy data from KPA datastore."""
   parser = self._parser_cls()
   try:
     return parser.read(self.store_path)
   except Exception, e:
     print traceback.format_exc() #XXX
     raise util.exc(e, "Could not parse KPA using %s" %
                       self._parser_cls, AlbumException)