Exemplo 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)
Exemplo n.º 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)
Exemplo n.º 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
Exemplo n.º 4
0
 def test_passes_other_exceptions(self):
     with testtools.ExpectedException(ValueError):
         with db_api.exc_to_retry(TypeError):
             raise ValueError()
Exemplo 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()
Exemplo n.º 6
0
 def test_translates_single_exception(self):
     with testtools.ExpectedException(db_exc.RetryRequest):
         with db_api.exc_to_retry(ValueError):
             raise ValueError()
Exemplo n.º 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
Exemplo n.º 8
0
 def test_passes_other_exceptions(self):
     with testtools.ExpectedException(ValueError):
         with db_api.exc_to_retry(TypeError):
             raise ValueError()
Exemplo n.º 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()
Exemplo n.º 10
0
 def test_translates_single_exception(self):
     with testtools.ExpectedException(db_exc.RetryRequest):
         with db_api.exc_to_retry(ValueError):
             raise ValueError()
Exemplo n.º 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())