Merge "Unit tests: Avoid deprecation warning for getargspec()"

This commit is contained in:
Zuul 2019-02-13 08:20:26 +00:00 committed by Gerrit Code Review
commit d19e0be516

View File

@ -14,6 +14,7 @@
import collections
import functools
import inspect
import six
from oslo_log import log as logging
from oslo_messaging import rpc
@ -29,7 +30,12 @@ def asynchronous(function):
run on a future iteration of the event loop.
"""
arg_names = inspect.getargspec(function).args
if six.PY2:
arg_names = inspect.getargspec(function).args
else:
sig = inspect.signature(function)
arg_names = [name for name, param in sig.parameters.items()
if param.kind == param.POSITIONAL_OR_KEYWORD]
MessageData = collections.namedtuple(function.__name__, arg_names[1:])
@functools.wraps(function)