Replace use of functools.wraps() with six.wraps()
In Python 2.7, functools.wraps() does not provide the '__wrapped__' attribute. This attribute is used by oslo_utils.reflection.get_signature() when getting the signature of a function. If a function is decorated without the '__wrapped__' attribute then the signature will be of the decorator rather than the underlying function. From the six documentation for six.wraps(): This is exactly the functools.wraps() decorator, but it sets the __wrapped__ attribute on what it decorates as functools.wraps() does on Python versions after 3.2. Change-Id: Ic1c3e27e1578c914a86a2faf694c72dfdbfbda18
This commit is contained in:
parent
f0603768b3
commit
d88fe9f3b0
|
@ -10,9 +10,9 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import functools
|
||||
|
||||
from oslo_serialization import jsonutils as json
|
||||
import six
|
||||
from six.moves import http_client
|
||||
from six.moves.urllib import parse as urllib
|
||||
from tempest.lib.common import api_version_utils
|
||||
|
@ -36,7 +36,7 @@ def reset_baremetal_api_microversion():
|
|||
def handle_errors(f):
|
||||
"""A decorator that allows to ignore certain types of errors."""
|
||||
|
||||
@functools.wraps(f)
|
||||
@six.wraps(f)
|
||||
def wrapper(*args, **kwargs):
|
||||
param_name = 'ignore_errors'
|
||||
ignored_errors = kwargs.get(param_name, tuple())
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import functools
|
||||
|
||||
import six
|
||||
from tempest import config
|
||||
from tempest.lib.common import api_version_utils
|
||||
from tempest.lib.common.utils import data_utils
|
||||
|
@ -41,7 +40,7 @@ def creates(resource):
|
|||
"""Decorator that adds resources to the appropriate cleanup list."""
|
||||
|
||||
def decorator(f):
|
||||
@functools.wraps(f)
|
||||
@six.wraps(f)
|
||||
def wrapper(cls, *args, **kwargs):
|
||||
resp, body = f(cls, *args, **kwargs)
|
||||
|
||||
|
|
Loading…
Reference in New Issue