From 09ad1ed7a3109a936f0e1bc9cbc904292607d70c Mon Sep 17 00:00:00 2001 From: ZhiQiang Fan Date: Fri, 16 May 2014 12:14:01 +0800 Subject: [PATCH] Remove out-dated exceptions There are some exceptions defined in exc module, which is introduced two years ago, and it is marked as DEPRECATED in the same time. It should be removed for now, since there are no longer used. Change-Id: I039575f37b0e6d1c30e447b74d61b8cd0b6bbd29 --- ceilometerclient/exc.py | 51 +--------------------------- ceilometerclient/tests/test_shell.py | 6 ++-- 2 files changed, 4 insertions(+), 53 deletions(-) diff --git a/ceilometerclient/exc.py b/ceilometerclient/exc.py index f0620b1e..dfa46def 100644 --- a/ceilometerclient/exc.py +++ b/ceilometerclient/exc.py @@ -35,11 +35,7 @@ class CommunicationError(BaseException): """Unable to communicate with server.""" -class ClientException(Exception): - """DEPRECATED.""" - - -class HTTPException(ClientException): +class HTTPException(BaseException): """Base exception for all HTTP-derived exceptions.""" code = 'N/A' @@ -68,38 +64,18 @@ class HTTPMultipleChoices(HTTPException): self.details) -class BadRequest(HTTPException): - """DEPRECATED.""" - code = 400 - - class HTTPBadRequest(HTTPException): code = 400 -class Unauthorized(HTTPException): - """DEPRECATED.""" - code = 401 - - class HTTPUnauthorized(HTTPException): code = 401 -class Forbidden(HTTPException): - """DEPRECATED.""" - code = 403 - - class HTTPForbidden(HTTPException): code = 403 -class NotFound(HTTPException): - """DEPRECATED.""" - code = 404 - - class HTTPNotFound(HTTPException): code = 404 @@ -108,20 +84,10 @@ class HTTPMethodNotAllowed(HTTPException): code = 405 -class Conflict(HTTPException): - """DEPRECATED.""" - code = 409 - - class HTTPConflict(HTTPException): code = 409 -class OverLimit(HTTPException): - """DEPRECATED.""" - code = 413 - - class HTTPOverLimit(HTTPException): code = 413 @@ -138,11 +104,6 @@ class HTTPBadGateway(HTTPException): code = 502 -class ServiceUnavailable(HTTPException): - """DEPRECATED.""" - code = 503 - - class HTTPServiceUnavailable(HTTPException): code = 503 @@ -160,13 +121,3 @@ def from_response(response, details=None): """Return an instance of an HTTPException based on httplib response.""" cls = _code_map.get(response.status, HTTPException) return cls(details) - - -class NoTokenLookupException(Exception): - """DEPRECATED.""" - pass - - -class EndpointNotFound(Exception): - """DEPRECATED.""" - pass diff --git a/ceilometerclient/tests/test_shell.py b/ceilometerclient/tests/test_shell.py index 1536abc1..82329b43 100644 --- a/ceilometerclient/tests/test_shell.py +++ b/ceilometerclient/tests/test_shell.py @@ -97,10 +97,10 @@ class ShellTest(utils.BaseTestCase): @mock.patch.object(ksclient, 'Client') def test_debug_switch_raises_error(self, mock_ksclient): - mock_ksclient.side_effect = exc.Unauthorized + mock_ksclient.side_effect = exc.HTTPUnauthorized self.make_env() args = ['--debug', 'event-list'] - self.assertRaises(exc.Unauthorized, ceilometer_shell.main, args) + self.assertRaises(exc.HTTPUnauthorized, ceilometer_shell.main, args) @mock.patch.object(ksclient, 'Client') def test_dash_d_switch_raises_error(self, mock_ksclient): @@ -111,7 +111,7 @@ class ShellTest(utils.BaseTestCase): @mock.patch.object(ksclient, 'Client') def test_no_debug_switch_no_raises_errors(self, mock_ksclient): - mock_ksclient.side_effect = exc.Unauthorized("FAIL") + mock_ksclient.side_effect = exc.HTTPUnauthorized("FAIL") self.make_env() args = ['event-list'] self.assertRaises(SystemExit, ceilometer_shell.main, args)