diff options
author | Chris Withers <chris@withers.org> | 2019-04-29 08:25:36 +0100 |
---|---|---|
committer | Chris Withers <chris@withers.org> | 2019-04-30 08:39:55 +0100 |
commit | 6611a75ef0c464fb11bdb6f731aa4d0366536b55 (patch) | |
tree | 8fd40263a482522060f92f5074b0a3cae2bfc044 /mock/tests/testhelpers.py | |
parent | a2e00f460953e2141684f4b6d7ad0097d37c340d (diff) | |
download | mock-6611a75ef0c464fb11bdb6f731aa4d0366536b55.tar.gz |
Have to use the funcsigs backport on Py2.
Diffstat (limited to 'mock/tests/testhelpers.py')
-rw-r--r-- | mock/tests/testhelpers.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/mock/tests/testhelpers.py b/mock/tests/testhelpers.py index a076297..34a8eae 100644 --- a/mock/tests/testhelpers.py +++ b/mock/tests/testhelpers.py @@ -18,6 +18,11 @@ from mock.mock import _Call, _CallList from datetime import datetime from functools import partial + +if six.PY2: + import funcsigs + + class SomeClass(object): def one(self, a, b): pass @@ -1000,7 +1005,10 @@ class SpecSignatureTest(unittest.TestCase): mock(1, 2) mock(x=1, y=2) - self.assertEqual(inspect.getfullargspec(mock), inspect.getfullargspec(myfunc)) + if six.PY2: + self.assertEqual(funcsigs.signature(mock), funcsigs.signature(myfunc)) + else: + self.assertEqual(inspect.getfullargspec(mock), inspect.getfullargspec(myfunc)) self.assertEqual(mock.mock_calls, [call(1, 2), call(x=1, y=2)]) self.assertRaises(TypeError, mock, 1) |