Merge "Unit tests: Avoid deprecation warning for getargspec()"
This commit is contained in:
commit
d19e0be516
|
@ -14,6 +14,7 @@
|
||||||
import collections
|
import collections
|
||||||
import functools
|
import functools
|
||||||
import inspect
|
import inspect
|
||||||
|
import six
|
||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_messaging import rpc
|
from oslo_messaging import rpc
|
||||||
|
@ -29,7 +30,12 @@ def asynchronous(function):
|
||||||
run on a future iteration of the event loop.
|
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:])
|
MessageData = collections.namedtuple(function.__name__, arg_names[1:])
|
||||||
|
|
||||||
@functools.wraps(function)
|
@functools.wraps(function)
|
||||||
|
|
Loading…
Reference in New Issue