summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Withers <chris@withers.org>2023-07-11 09:52:12 +0100
committerChris Withers <chris@withers.org>2023-07-11 14:19:58 +0100
commit73343195e09fd20b9a39187a71c138fa13e02f9d (patch)
tree3cad27ba1401b59a2cacc23a9372b638da80baec
parentf0cc38503e2d91341ca4e263d5acf934b7c0d130 (diff)
downloadmock-73343195e09fd20b9a39187a71c138fa13e02f9d.tar.gz
Remove unused branches from mock module (#106617)
* lambda has a name of __none__, but no async lambda so this branch is not needed * _get_signature_object only returns None for bound builtins. There are no async builtins so this branch isn't needed * Exclude a couple of methods from coverage checking in the downstream rolling backport of mock Backports: e6379f72cbc60f6b3c5676f9e225d4f145d5693f Signed-off-by: Chris Withers <chris@simplistix.co.uk>
-rw-r--r--mock/mock.py7
-rw-r--r--mock/tests/testthreadingmock.py4
2 files changed, 3 insertions, 8 deletions
diff --git a/mock/mock.py b/mock/mock.py
index fba26bd..448b7ef 100644
--- a/mock/mock.py
+++ b/mock/mock.py
@@ -214,17 +214,12 @@ def _set_async_signature(mock, original, instance=False, is_async_mock=False):
# signature as the original.
skipfirst = isinstance(original, type)
- result = _get_signature_object(original, instance, skipfirst)
- if result is None:
- return mock
- func, sig = result
+ func, sig = _get_signature_object(original, instance, skipfirst)
def checksig(*args, **kwargs):
sig.bind(*args, **kwargs)
_copy_func_details(func, checksig)
name = original.__name__
- if not name.isidentifier():
- name = 'funcopy'
context = {'_checksig_': checksig, 'mock': mock}
src = """async def %s(*args, **kwargs):
_checksig_(*args, **kwargs)
diff --git a/mock/tests/testthreadingmock.py b/mock/tests/testthreadingmock.py
index 3637d81..6288e2d 100644
--- a/mock/tests/testthreadingmock.py
+++ b/mock/tests/testthreadingmock.py
@@ -7,10 +7,10 @@ from mock import patch, ThreadingMock, call
class Something:
def method_1(self):
- pass
+ pass # pragma: no cover
def method_2(self):
- pass
+ pass # pragma: no cover
class TestThreadingMock(unittest.TestCase):