New submission from Aniket Panse <aniketpa...@gmail.com>: Currently, patch is unable to correctly patch coroutinefunctions decorated with `@staticmethod` or `@classmethod`.
Example: ``` [*] aniketpanse [~/git/cpython] -> ./python ±[master] Python 3.9.0a1+ (heads/master:50d4f12958, Dec 17 2019, 16:31:30) [GCC 9.2.1 20190827 (Red Hat 9.2.1-1)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> class Helper: ... @classmethod ... async def async_class_method(cls): ... pass ... >>> from unittest.mock import patch >>> patch("Helper.async_class_method") <unittest.mock._patch object at 0x7fc28ddbbf40> ``` This should ideally return an `AsyncMock()`. ---------- components: Tests, asyncio messages: 358601 nosy: asvetlov, czardoz, yselivanov priority: normal severity: normal status: open title: AsyncMock is unable to correctly patch static or class methods versions: Python 3.8, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39082> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com