pythonPackages.funcsigs: fix tests on pypy3

This package has a spurious test failure on PyPy3, which was reported
upstream a while ago:

https://github.com/testing-cabal/funcsigs/issues/10

This is fixed thanks to the included patch, which was authored and is
also used by the Gentoo Python team.

With this, packages like 'pytest' and 'click' now work under PyPy3.

Signed-off-by: Austin Seipp <aseipp@pobox.com>

+99 -1
+5 -1
pkgs/development/python-modules/funcsigs/default.nix
··· 1 1 { stdenv, buildPythonPackage, fetchPypi 2 - , unittest2 }: 2 + , isPyPy, isPy3k, unittest2 3 + }: 3 4 4 5 buildPythonPackage rec { 5 6 pname = "funcsigs"; ··· 11 12 }; 12 13 13 14 buildInputs = [ unittest2 ]; 15 + 16 + # https://github.com/testing-cabal/funcsigs/issues/10 17 + patches = stdenv.lib.optional (isPyPy && isPy3k) [ ./fix-pypy3-tests.patch ]; 14 18 15 19 meta = with stdenv.lib; { 16 20 description = "Python function signatures from PEP362 for Python 2.6, 2.7 and 3.2+";
+94
pkgs/development/python-modules/funcsigs/fix-pypy3-tests.patch
··· 1 + diff --git a/tests/test_inspect.py b/tests/test_inspect.py 2 + index 98d6592..3a2a1f2 100644 3 + --- a/tests/test_inspect.py 4 + +++ b/tests/test_inspect.py 5 + @@ -8,6 +8,7 @@ import unittest2 as unittest 6 + 7 + import funcsigs as inspect 8 + 9 + +import platform 10 + 11 + class TestSignatureObject(unittest.TestCase): 12 + @staticmethod 13 + @@ -409,7 +410,7 @@ def test_signature_on_decorated(self): 14 + Ellipsis)) 15 + """) 16 + 17 + - if sys.version_info[0] > 2: 18 + + if sys.version_info[0] > 2 and platform.python_implementation() != "PyPy": 19 + exec(""" 20 + def test_signature_on_class(self): 21 + class C: 22 + @@ -493,41 +494,44 @@ def test_signature_on_class(self): 23 + Ellipsis)) 24 + """) 25 + 26 + - def test_signature_on_callable_objects(self): 27 + - class Foo(object): 28 + - def __call__(self, a): 29 + - pass 30 + + if platform.python_implementation() != "PyPy": 31 + + exec(""" 32 + +def test_signature_on_callable_objects(self): 33 + + class Foo(object): 34 + + def __call__(self, a): 35 + + pass 36 + 37 + - self.assertEqual(self.signature(Foo()), 38 + - ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),), 39 + - Ellipsis)) 40 + + self.assertEqual(self.signature(Foo()), 41 + + ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),), 42 + + Ellipsis)) 43 + 44 + - class Spam(object): 45 + - pass 46 + - with self.assertRaisesRegex(TypeError, "is not a callable object"): 47 + - inspect.signature(Spam()) 48 + + class Spam(object): 49 + + pass 50 + + with self.assertRaisesRegex(TypeError, "is not a callable object"): 51 + + inspect.signature(Spam()) 52 + 53 + - class Bar(Spam, Foo): 54 + - pass 55 + + class Bar(Spam, Foo): 56 + + pass 57 + 58 + - self.assertEqual(self.signature(Bar()), 59 + - ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),), 60 + - Ellipsis)) 61 + + self.assertEqual(self.signature(Bar()), 62 + + ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),), 63 + + Ellipsis)) 64 + 65 + - class ToFail(object): 66 + - __call__ = type 67 + - with self.assertRaisesRegex(ValueError, "not supported by signature"): 68 + - inspect.signature(ToFail()) 69 + + class ToFail(object): 70 + + __call__ = type 71 + + with self.assertRaisesRegex(ValueError, "not supported by signature"): 72 + + inspect.signature(ToFail()) 73 + 74 + - if sys.version_info[0] < 3: 75 + - return 76 + + if sys.version_info[0] < 3: 77 + + return 78 + 79 + - class Wrapped(object): 80 + - pass 81 + - Wrapped.__wrapped__ = lambda a: None 82 + - self.assertEqual(self.signature(Wrapped), 83 + - ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),), 84 + - Ellipsis)) 85 + + class Wrapped(object): 86 + + pass 87 + + Wrapped.__wrapped__ = lambda a: None 88 + + self.assertEqual(self.signature(Wrapped), 89 + + ((('a', Ellipsis, Ellipsis, "positional_or_keyword"),), 90 + + Ellipsis)) 91 + +""") 92 + 93 + def test_signature_on_lambdas(self): 94 + self.assertEqual(self.signature((lambda a=10: a)),