Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment:
Not sure if it helps. Set backlog in the below test as 1. Add a print statement print(type(_mock_call)) at [0] . I could see some of _mock_call to be AsyncMock . So instead of calling return _mock_self._mock_call(*args, **kwargs) directly if I call them only with they are not instance of AsyncMock (not isinstance(_mock_self, AsyncMock)) then the warning goes away. Guess somewhere an AsyncMock is created as I can see _accept_connection2. When the backlog value is set to 100 it shows lot of warnings. $ ./python.exe -Werror -X tracemalloc -m unittest -vv test.test_asyncio.test_selector_events.BaseSelectorEventLoopTests.test_accept_connection_multiple test_accept_connection_multiple (test.test_asyncio.test_selector_events.BaseSelectorEventLoopTests) ... <AsyncMock name='_accept_connection2' id='4465398880'> <class 'unittest.mock.Mock'> <class 'unittest.mock.Mock'> <class 'unittest.mock.AsyncMock'> <class 'unittest.mock.MagicMock'> <class 'unittest.mock.Mock'> ok ---------------------------------------------------------------------- Ran 1 test in 0.123s OK Exception ignored in: <coroutine object AsyncMockMixin._mock_call at 0x10a2a0e60> Traceback (most recent call last): File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/warnings.py", line 510, in _warn_unawaited_coroutine warn(msg, category=RuntimeWarning, stacklevel=2, source=coro) RuntimeWarning: coroutine 'AsyncMockMixin._mock_call' was never awaited [0] https://github.com/python/cpython/blob/b121f63155d8e3c7c42ab6122e36eaf7f5e9f7f5/Lib/unittest/mock.py#L991 ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue37015> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com