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
This commit is contained in:
Brant Knudson
2015-07-24 14:14:13 -05:00
parent fee5ba7432
commit c5b03191b6
2 changed files with 13 additions and 2 deletions

View File

@@ -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):

View File

@@ -94,6 +94,7 @@ class ManagerTest(utils.TestCase):
self.mgr.resource_class = base.Resource
def test_api(self):
with self.deprecations.expect_deprecations_here():
self.assertEqual(self.mgr.api, self.client)
def test_get(self):