예제 #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)
예제 #2
0
파일: test_api.py 프로젝트: 21atlas/neutron
 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)
예제 #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
예제 #4
0
 def test_passes_other_exceptions(self):
     with testtools.ExpectedException(ValueError):
         with db_api.exc_to_retry(TypeError):
             raise ValueError()
예제 #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()
예제 #6
0
 def test_translates_single_exception(self):
     with testtools.ExpectedException(db_exc.RetryRequest):
         with db_api.exc_to_retry(ValueError):
             raise ValueError()
예제 #7
0
파일: test_api.py 프로젝트: 21atlas/neutron
 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
예제 #8
0
파일: test_api.py 프로젝트: 21atlas/neutron
 def test_passes_other_exceptions(self):
     with testtools.ExpectedException(ValueError):
         with db_api.exc_to_retry(TypeError):
             raise ValueError()
예제 #9
0
파일: test_api.py 프로젝트: 21atlas/neutron
 def test_translates_multiple_exception_types(self):
     with testtools.ExpectedException(db_exc.RetryRequest):
         with db_api.exc_to_retry((ValueError, TypeError)):
             raise TypeError()
예제 #10
0
파일: test_api.py 프로젝트: 21atlas/neutron
 def test_translates_single_exception(self):
     with testtools.ExpectedException(db_exc.RetryRequest):
         with db_api.exc_to_retry(ValueError):
             raise ValueError()
예제 #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())