Example #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)
Example #2
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)
Example #3
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
Example #4
0
 def test_passes_other_exceptions(self):
     with testtools.ExpectedException(ValueError):
         with db_api.exc_to_retry(TypeError):
             raise ValueError()
Example #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()
Example #6
0
 def test_translates_single_exception(self):
     with testtools.ExpectedException(db_exc.RetryRequest):
         with db_api.exc_to_retry(ValueError):
             raise ValueError()
Example #7
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
Example #8
0
 def test_passes_other_exceptions(self):
     with testtools.ExpectedException(ValueError):
         with db_api.exc_to_retry(TypeError):
             raise ValueError()
Example #9
0
 def test_translates_multiple_exception_types(self):
     with testtools.ExpectedException(db_exc.RetryRequest):
         with db_api.exc_to_retry((ValueError, TypeError)):
             raise TypeError()
Example #10
0
 def test_translates_single_exception(self):
     with testtools.ExpectedException(db_exc.RetryRequest):
         with db_api.exc_to_retry(ValueError):
             raise ValueError()
Example #11
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())