Esempio n. 1
0
 def test_inner_exception_preserved_in_retryrequest(self):
     try:
         exc = ValueError('test')
         with db_api.exc_to_retry(ValueError):
             raise exc
     except db_exc.RetryRequest as e:
         self.assertEqual(exc, e.inner_exc)
Esempio n. 2
0
 def test_retries_on_multi_exception_containing_target(self):
     with testtools.ExpectedException(db_exc.RetryRequest):
         with db_api.exc_to_retry(ValueError):
             e = exceptions.MultipleExceptions([ValueError(), TypeError()])
             raise e
Esempio n. 3
0
 def test_passes_other_exceptions(self):
     with testtools.ExpectedException(ValueError):
         with db_api.exc_to_retry(TypeError):
             raise ValueError()
Esempio n. 4
0
 def test_translates_DBerror_inner_exception(self):
     with testtools.ExpectedException(db_exc.RetryRequest):
         with db_api.exc_to_retry(ValueError):
             raise db_exc.DBError(ValueError())
Esempio n. 5
0
 def test_translates_multiple_exception_types(self):
     with testtools.ExpectedException(db_exc.RetryRequest):
         with db_api.exc_to_retry((ValueError, TypeError)):
             raise TypeError()
Esempio n. 6
0
 def test_translates_single_exception(self):
     with testtools.ExpectedException(db_exc.RetryRequest):
         with db_api.exc_to_retry(ValueError):
             raise ValueError()