aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/unittest
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/unittest')
-rw-r--r--Lib/unittest/mock.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py
index 7ca08576065..22f81e55b56 100644
--- a/Lib/unittest/mock.py
+++ b/Lib/unittest/mock.py
@@ -526,7 +526,13 @@ class NonCallableMock(Base):
spec_list = dir(spec)
for attr in spec_list:
- if iscoroutinefunction(getattr(spec, attr, None)):
+ static_attr = inspect.getattr_static(spec, attr, None)
+ unwrapped_attr = static_attr
+ try:
+ unwrapped_attr = inspect.unwrap(unwrapped_attr)
+ except ValueError:
+ pass
+ if iscoroutinefunction(unwrapped_attr):
_spec_asyncs.append(attr)
spec = spec_list