Small cleanup for unit/proxy/controllers/test_obj

Follow up for https://review.openstack.org/#/c/236007

This fixes following minor items:

- Fix a 'raise Exception class' syntax to 'raise Exception instance'
- Use original eventlet.Timeout instead of swift.exceptions.Timeout
  imported from eventlet.Timeout
- Change Timeout to initiate w/o args (1st arguments should be timeout
  second and we don't have to set None if we don't want to set the sec)
- Add a message argument to some Exception instances

Change-Id: Iab608cd8a1f4d3f5b4963c26b94ab0501837ffe1
This commit is contained in:
Kota Tsuyuzaki 2015-11-11 07:55:51 -08:00
parent 66dc1eebb1
commit fd30df6e65

View File

@ -615,7 +615,7 @@ class TestReplicatedObjController(BaseObjectControllerMixin,
def test_PUT_error_during_transfer_data(self):
class FakeReader(object):
def read(self, size):
raise exceptions.ChunkReadError(None)
raise exceptions.ChunkReadError('exception message')
req = swob.Request.blank('/v1/a/c/o.jpg', method='PUT',
body='test body')
@ -630,7 +630,7 @@ class TestReplicatedObjController(BaseObjectControllerMixin,
def test_PUT_chunkreadtimeout_during_transfer_data(self):
class FakeReader(object):
def read(self, size):
raise exceptions.ChunkReadTimeout(None)
raise exceptions.ChunkReadTimeout()
req = swob.Request.blank('/v1/a/c/o.jpg', method='PUT',
body='test body')
@ -645,7 +645,7 @@ class TestReplicatedObjController(BaseObjectControllerMixin,
def test_PUT_timeout_during_transfer_data(self):
class FakeReader(object):
def read(self, size):
raise exceptions.Timeout(None)
raise Timeout()
req = swob.Request.blank('/v1/a/c/o.jpg', method='PUT',
body='test body')
@ -660,7 +660,7 @@ class TestReplicatedObjController(BaseObjectControllerMixin,
def test_PUT_exception_during_transfer_data(self):
class FakeReader(object):
def read(self, size):
raise Exception
raise Exception('exception message')
req = swob.Request.blank('/v1/a/c/o.jpg', method='PUT',
body='test body')
@ -1329,7 +1329,7 @@ class TestECObjController(BaseObjectControllerMixin, unittest.TestCase):
def test_PUT_ec_error_during_transfer_data(self):
class FakeReader(object):
def read(self, size):
raise exceptions.ChunkReadError(None)
raise exceptions.ChunkReadError('exception message')
req = swob.Request.blank('/v1/a/c/o.jpg', method='PUT',
body='test body')
@ -1349,7 +1349,7 @@ class TestECObjController(BaseObjectControllerMixin, unittest.TestCase):
def test_PUT_ec_chunkreadtimeout_during_transfer_data(self):
class FakeReader(object):
def read(self, size):
raise exceptions.ChunkReadTimeout(None)
raise exceptions.ChunkReadTimeout()
req = swob.Request.blank('/v1/a/c/o.jpg', method='PUT',
body='test body')
@ -1369,7 +1369,7 @@ class TestECObjController(BaseObjectControllerMixin, unittest.TestCase):
def test_PUT_ec_timeout_during_transfer_data(self):
class FakeReader(object):
def read(self, size):
raise exceptions.Timeout(None)
raise exceptions.Timeout()
req = swob.Request.blank('/v1/a/c/o.jpg', method='PUT',
body='test body')
@ -1389,7 +1389,7 @@ class TestECObjController(BaseObjectControllerMixin, unittest.TestCase):
def test_PUT_ec_exception_during_transfer_data(self):
class FakeReader(object):
def read(self, size):
raise Exception(None)
raise Exception('exception message')
req = swob.Request.blank('/v1/a/c/o.jpg', method='PUT',
body='test body')