Skip to content

Commit

Permalink
Fix issue with "inspect" on Python 3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
mdmintz committed May 24, 2023
1 parent e9fccf9 commit 0775045
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions nose/plugins/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
__all__ = ['DefaultPluginManager', 'PluginManager', 'EntryPointPluginManager',
'BuiltinPluginManager', 'RestrictedPluginManager']
log = logging.getLogger(__name__)
if not hasattr(inspect, "getargspec"):
inspect.getargspec = lambda func: inspect.getfullargspec(func)[:4]


class PluginProxy(object):
Expand Down
5 changes: 4 additions & 1 deletion nose/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
skip_pattern = (
r"(?:\.svn)|(?:[^.]+\.py[co])|(?:.*~)|(?:.*\$py\.class)|(?:__pycache__)"
)
if not hasattr(inspect, "getargspec"):
inspect.getargspec = lambda func: inspect.getfullargspec(func)[:4]
try:
set()
except NameError:
Expand Down Expand Up @@ -422,8 +424,9 @@ def try_run(obj, names):
):
func = func.__call__
try:
args, varargs, varkw, defaults = \
args, varargs, varkw, defaults = (
inspect.getargspec(func)
)
args.pop(0) # pop the self off
except TypeError:
raise TypeError("Attribute %s of %r is not a python "
Expand Down

0 comments on commit 0775045

Please sign in to comment.