Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
simplify
  • Loading branch information
hongweipeng committed Feb 15, 2022
commit e70c22feaa1cd8e4d7dcd97390f573618d134685
5 changes: 2 additions & 3 deletions Lib/unittest/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,9 +496,8 @@ def _mock_add_spec(self, spec, spec_set, _spec_as_instance=False,
_spec_signature = None
_spec_asyncs = []

for attr, value in inspect.getmembers_static(spec):
if iscoroutinefunction(value):
_spec_asyncs.append(attr)
for attr, _ in inspect.getmembers_static(spec, iscoroutinefunction):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about async classmethods? Would those still get recognized as coroutines?

_spec_asyncs.append(attr)

if spec is not None and not _is_list(spec):
if isinstance(spec, type):
Expand Down