From ef0a7a9a7c24776e35574efb35dff5a0d56a269f Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller <j.m.carcell@cern.ch> Date: Tue, 12 Sep 2023 15:48:10 +0200 Subject: [PATCH] Use inspect.signature instead of the deprecated getargspec --- GaudiPolicy/python/GaudiTesting/QMTTest.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/GaudiPolicy/python/GaudiTesting/QMTTest.py b/GaudiPolicy/python/GaudiTesting/QMTTest.py index 25d1f6c98e..b0f4f4d3d8 100644 --- a/GaudiPolicy/python/GaudiTesting/QMTTest.py +++ b/GaudiPolicy/python/GaudiTesting/QMTTest.py @@ -75,9 +75,19 @@ class QMTTest(BaseTest): self.callable = callable self.extra_args = extra_args # get the list of names of positional arguments - from inspect import getargspec + try: + # Removed in Python 3.11 + from inspect import getargspec - self.args_order = getargspec(callable)[0] + self.args_order = getargspec(callable)[0] + except ImportError: + import inspect + + self.args_order = [ + param.name + for param in inspect.signature(callable).parameters.values() + if param.kind == inspect.Parameter.POSITIONAL_OR_KEYWORD + ] # Remove "self" from the list of positional arguments # since it is added automatically if self.args_order[0] == "self": -- GitLab