From c5b03191b6714fed15bd88769c89e897257c337d Mon Sep 17 00:00:00 2001 From: Brant Knudson Date: Fri, 24 Jul 2015 14:14:13 -0500 Subject: [PATCH] Proper deprecation for Manager.api base.Manager's api property wasn't properly deprecated since all it had was documentation. Proper deprecation requires use of warnings and documentation. bp deprecations Change-Id: Ic5e218151e9b3f3b66f78729052680691d5ad582 --- keystoneclient/base.py | 12 +++++++++++- keystoneclient/tests/unit/test_base.py | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/keystoneclient/base.py b/keystoneclient/base.py index eabbdc4fb..d2c3ea06c 100644 --- a/keystoneclient/base.py +++ b/keystoneclient/base.py @@ -21,6 +21,7 @@ Base utilities to build API operation managers and objects on top of. import abc import functools +import warnings import six from six.moves import urllib @@ -91,8 +92,17 @@ class Manager(object): @property def api(self): - """Deprecated. Use `client` instead. + """The client. + + .. warning:: + + This property is deprecated as of the 1.7.0 release in favor of + :meth:`client` and may be removed in the 2.0.0 release. + """ + warnings.warn( + 'api is deprecated as of the 1.7.0 release in favor of client and ' + 'may be removed in the 2.0.0 release', DeprecationWarning) return self.client def _list(self, url, response_key, obj_class=None, body=None, **kwargs): diff --git a/keystoneclient/tests/unit/test_base.py b/keystoneclient/tests/unit/test_base.py index dcfbb137f..6871702d6 100644 --- a/keystoneclient/tests/unit/test_base.py +++ b/keystoneclient/tests/unit/test_base.py @@ -94,7 +94,8 @@ class ManagerTest(utils.TestCase): self.mgr.resource_class = base.Resource def test_api(self): - self.assertEqual(self.mgr.api, self.client) + with self.deprecations.expect_deprecations_here(): + self.assertEqual(self.mgr.api, self.client) def test_get(self): get_mock = self.useFixture(mockpatch.PatchObject(