Skip to content

Commit

Permalink
Merge pull request #6 from mdmintz/fix-inspect-issue-on-python-3-11
Browse files Browse the repository at this point in the history
Fix issue with "inspect" on Python 3.11
  • Loading branch information
mdmintz authored May 24, 2023
2 parents e9fccf9 + 5060c7d commit 721cbb8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ This version of ``nose`` is compatible with Python 3.6+ (including 3.12 & up).

Changes in ``pynose`` from legacy ``nose`` include:
* Fixes "AttributeError: module 'collections' has no attribute 'Callable'."
* Fixes all ``flake8`` issues from the original ``nose``.
* Fixes "AttributeError: module 'inspect' has no attribute 'getargspec'."
* Fixes "ImportError: cannot import name '_TextTestResult' from 'unittest'."
* Fixes "RuntimeWarning: TestResult has no addDuration method."
* Fixes all ``flake8`` issues from the original ``nose``.
* Replaces the ``imp`` module with the newer ``importlib`` module.
* The default logging level now hides "debug" logs for less noise.
* The ``-s`` option is always active to see the output of ``print()``.
Expand Down
2 changes: 1 addition & 1 deletion nose/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# pynose nose package
__version__ = "1.4.4"
__version__ = "1.4.5"
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 721cbb8

Please sign in to comment.