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
This commit is contained in:
parent
63cdc14853
commit
07fd2f2c47
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user