Commit 07fd2f2c authored by Takashi Kajinami's avatar Takashi Kajinami
Browse files

Replace deprecated inspect.getargspec

inspect.getargspec was deprecated since Python 3.0 and
inspect.getfullargspec is its replacement with correct handling of
function annotations and keyword-only parameters[1].

[1] https://docs.python.org/3/library/inspect.html#inspect.getargspec

Change-Id: I29478df88665ee5311e3ba308ab645c47e5b0fc8
parent 63cdc148
......@@ -178,8 +178,8 @@ class TestCase(testtools.TestCase):
baseclass)
for name in sorted(implmethods.keys()):
baseargs = inspect.getargspec(basemethods[name])
implargs = inspect.getargspec(implmethods[name])
baseargs = inspect.getfullargspec(basemethods[name])
implargs = inspect.getfullargspec(implmethods[name])
self.assertEqual(baseargs, implargs,
"%s args don't match base class %s" %
......
......@@ -757,9 +757,11 @@ class TestMethodSpec(test.TestCase):
self._test_method3 = test_method3
def test_method_spec_compat(self):
self.assertEqual(inspect.getargspec(self._test_method1),
self.assertEqual(inspect.ArgSpec(args=['a', 'b', 'kw1'], varargs=None,
keywords='kwargs', defaults=(123,)),
fixture.get_method_spec(self._test_method1))
self.assertEqual(inspect.getargspec(self._test_method2),
self.assertEqual(inspect.ArgSpec(args=['a', 'b'], varargs='args',
keywords=None, defaults=None),
fixture.get_method_spec(self._test_method2))
self.assertEqual(inspect.getfullargspec(self._test_method3),
fixture.get_method_spec(self._test_method3))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment