Remove use of deprecated APIs

inspect.getargspec is gone in Python 3.11.

unittest.TestCase.assertRaisesRegex is preferred to
unittest.TestCase.assertRaisesRegexp.

Change-Id: Ib6ec492e8c892424ab408a96696df346c3bbfde3
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2023-09-05 11:13:19 +01:00
parent 16eeb35127
commit 87c586051f
2 changed files with 9 additions and 8 deletions

View File

@ -177,9 +177,10 @@ class TestTypes(unittest.TestCase):
obj.a = 'v1'
assert obj.a == 'v1', repr(obj.a)
self.assertRaisesRegexp(exc.InvalidInput,
"Invalid input for field/attribute a. \
Value: 'v3'. Value should be one of: v., v.",
self.assertRaisesRegex(
exc.InvalidInput,
"Invalid input for field/attribute a. "
"Value: 'v3'. Value should be one of: v., v.",
setattr,
obj,
'a',

View File

@ -42,7 +42,7 @@ def signature(*args, **kw):
sig = wsme.signature(*args, **kw)
def decorator(f):
args = inspect.getargspec(f)[0]
args = inspect.getfullargspec(f)[0]
ismethod = args and args[0] == 'self'
sig(f)
funcdef = wsme.api.FunctionDefinition.get(f)