

def test_async_run_exc(self):

    class InLoopException(Exception):
        pass
    job = self.mock.Mock()
    job.side_effect = InLoopException('test exception')
    t = self.service.getTask(TestDBusSessionTask)
    ft = t.asyncRun(job)
    self.assertRaises(InLoopException, (lambda : ft.result()))
    self.assertTrue(job.called)

dataset/ETHPy150Open facebook/sparts/tests/tasks/test_dbus.py TestDBus.test_async_run_exc/original