Merge "Remove a redundant self argument in decorators"

This commit is contained in:
Zuul 2017-11-28 20:55:51 +00:00 committed by Gerrit Code Review
commit 3df36ad64e
2 changed files with 4 additions and 4 deletions

View File

@ -78,7 +78,7 @@ def services(*args):
decorators.attr(type=list(args))(f) decorators.attr(type=list(args))(f)
@functools.wraps(f) @functools.wraps(f)
def wrapper(self, *func_args, **func_kwargs): def wrapper(*func_args, **func_kwargs):
service_list = get_service_list() service_list = get_service_list()
for service in args: for service in args:
@ -86,7 +86,7 @@ def services(*args):
msg = 'Skipped because the %s service is not available' % ( msg = 'Skipped because the %s service is not available' % (
service) service)
raise testtools.TestCase.skipException(msg) raise testtools.TestCase.skipException(msg)
return f(self, *func_args, **func_kwargs) return f(*func_args, **func_kwargs)
return wrapper return wrapper
return decorator return decorator

View File

@ -56,9 +56,9 @@ def related_bug(bug, status_code=None):
""" """
def decorator(f): def decorator(f):
@functools.wraps(f) @functools.wraps(f)
def wrapper(self, *func_args, **func_kwargs): def wrapper(*func_args, **func_kwargs):
try: try:
return f(self, *func_args, **func_kwargs) return f(*func_args, **func_kwargs)
except Exception as exc: except Exception as exc:
exc_status_code = getattr(exc, 'status_code', None) exc_status_code = getattr(exc, 'status_code', None)
if status_code is None or status_code == exc_status_code: if status_code is None or status_code == exc_status_code: