mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-10 22:00:09 +02:00
nose: clean up, support Python 3.10. (#8825)
Due to changes in setuptools, we need to run 2to3 ourselves. While we're at it, lets apply relevant patches from Debian. https://salsa.debian.org/python-team/packages/nose/
This commit is contained in:
79
dev-python/nose/patches/debian/python3.11.diff
Normal file
79
dev-python/nose/patches/debian/python3.11.diff
Normal file
@@ -0,0 +1,79 @@
|
||||
From 5221885fd4fea96edff3e7692cef4531e166e15c Mon Sep 17 00:00:00 2001
|
||||
From: Thomas A Caswell <tcaswell@gmail.com>
|
||||
Date: Sat, 26 Sep 2015 23:50:21 -0400
|
||||
Subject: MNT: hide getargspec usage for 3.6 compatibility
|
||||
Origin: other, https://github.com/nose-devs/nose/pull/1117
|
||||
--- nose.orig/nose/plugins/manager.py
|
||||
+++ nose/nose/plugins/manager.py
|
||||
@@ -104,8 +104,19 @@
|
||||
"""
|
||||
meth = getattr(plugin, call, None)
|
||||
if meth is not None:
|
||||
- if call == 'loadTestsFromModule' and \
|
||||
- len(inspect.getargspec(meth)[0]) == 2:
|
||||
+ try:
|
||||
+ sig = inspect.signature(meth)
|
||||
+ bl = set([inspect.Parameter.VAR_KEYWORD,
|
||||
+ inspect.Parameter.VAR_POSITIONAL,
|
||||
+ inspect.Parameter.KEYWORD_ONLY])
|
||||
+ args = [k for k, v in sig.parameters.items()
|
||||
+ if v.kind not in bl]
|
||||
+ arg_len = len(args)
|
||||
+ if hasattr(meth, '__self__'):
|
||||
+ arg_len += 1
|
||||
+ except AttributeError:
|
||||
+ arg_len = len(inspect.getargspec(meth)[0])
|
||||
+ if call == 'loadTestsFromModule' and arg_len == 2:
|
||||
orig_meth = meth
|
||||
meth = lambda module, path, **kwargs: orig_meth(module)
|
||||
self.plugins.append((plugin, meth))
|
||||
@@ -153,6 +164,7 @@
|
||||
if result is not None:
|
||||
for r in result:
|
||||
yield r
|
||||
+
|
||||
except (KeyboardInterrupt, SystemExit):
|
||||
raise
|
||||
except:
|
||||
--- nose.orig/nose/util.py
|
||||
+++ nose/nose/util.py
|
||||
@@ -449,16 +449,34 @@
|
||||
if type(obj) == types.ModuleType:
|
||||
# py.test compatibility
|
||||
if isinstance(func, types.FunctionType):
|
||||
- args, varargs, varkw, defaults = \
|
||||
- inspect.getargspec(func)
|
||||
+ try:
|
||||
+ sig = inspect.signature(func)
|
||||
+ bl = set([inspect.Parameter.VAR_KEYWORD,
|
||||
+ inspect.Parameter.VAR_POSITIONAL,
|
||||
+ inspect.Parameter.KEYWORD_ONLY])
|
||||
+ args = [k for k, v in sig.parameters.items()
|
||||
+ if v.kind not in bl]
|
||||
+ except AttributeError:
|
||||
+ args, varargs, varkw, defaults = \
|
||||
+ inspect.getargspec(func)
|
||||
+
|
||||
else:
|
||||
# Not a function. If it's callable, call it anyway
|
||||
if hasattr(func, '__call__') and not inspect.ismethod(func):
|
||||
func = func.__call__
|
||||
try:
|
||||
- args, varargs, varkw, defaults = \
|
||||
- inspect.getargspec(func)
|
||||
- args.pop(0) # pop the self off
|
||||
+ try:
|
||||
+ sig = inspect.signature(func)
|
||||
+ bl = set([inspect.Parameter.VAR_KEYWORD,
|
||||
+ inspect.Parameter.VAR_POSITIONAL,
|
||||
+ inspect.Parameter.KEYWORD_ONLY])
|
||||
+ args = [k for k, v in sig.parameters.items()
|
||||
+ if v.kind not in bl]
|
||||
+
|
||||
+ except AttributeError:
|
||||
+ 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 "
|
||||
"function. Only functions or callables"
|
||||
Reference in New Issue
Block a user