Jason Fried <m...@jasonfried.info> added the comment:

Its not possible to have it both ways.  Also it stinks too much of trying to 
guess. 

The root of your issue is you want a normal MagicMock not an AsyncMock. Its the 
automatic behavior of patch to pick AsyncMock vs MagicMock that is the heart of 
your issue.  This bug fix doesn't involve that behavior at all, and AsyncMock 
was measurably broken without the fix, in an unavoidable way.  Your breakage is 
avoidable by changes to how you patch.  

 with patch("bar", return_value=42)

To still do it the old way you would have to pass new_callable=MagicMock to 
patch.

----------

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

Reply via email to