Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment:
Sorry, is there an example of this use case. I went through the issue but have trouble understanding it since there are different suggestions. I guess child mock is always an AsyncMock irrespective of sync/async as I understand. We already had some reports over detecting async while patching to return AsyncMock and also had to document it to the users along with covering different ways of async functions. from unittest.mock import AsyncMock class Foo: def foo(self): pass async def bar(self): pass m = AsyncMock(Foo) f = m() print(m.foo) print(m.bar) $ python3.8 /tmp/bar.py <AsyncMock name='mock.foo' id='4313089744'> <AsyncMock name='mock.bar' id='4313395696'> sys:1: RuntimeWarning: coroutine 'AsyncMockMixin._mock_call' was never awaited ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38122> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com