This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author czardoz
Recipients asvetlov, czardoz, yselivanov
Date 2019-12-18.00:36:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1576629405.73.0.979234563097.issue39082@roundup.psfhosted.org>
In-reply-to
Content
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()`.
History
Date User Action Args
2019-12-18 00:36:45czardozsetrecipients: + czardoz, asvetlov, yselivanov
2019-12-18 00:36:45czardozsetmessageid: <1576629405.73.0.979234563097.issue39082@roundup.psfhosted.org>
2019-12-18 00:36:45czardozlinkissue39082 messages
2019-12-18 00:36:45czardozcreate