Hiroyuki Takagi added the comment:

Thank you for reviewing patch.

I wrote test and updated patch. To pass the test, both this patch and 
issue25599's patch are required.

Changes of the patch:
- copy __code__ not only functions but also methods
- add autospec (create_autospec) suppoort

I have completely missed about autospec, thank you for a mention about it.
For autospec, simply copying original __code__ to funcopy makes error on 
existing tests.
That's why I changed the src of exec, but it seems to be quite ad-hoc. It may 
be better to be improved, but I don't have any good idea, sorry.

On the tests of this patch, I wonder if it's better to use assertIs(.., 
True/False) instead of assertTrue/False, since it was one of the problem in 
issue25599.
To apply this change and pass test, need to change asyncio.iscoroutinefunction 
to return bool. The change would be very easy, just update issue25599's patch 
like `return_value = bool(getattr(func, ...`.

----------
Added file: http://bugs.python.org/file41664/mock2.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26140>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to