[issue38163] AsyncMock child mocks should detect their type

Lisa Roach report at bugs.python.org
Thu Sep 26 01:05:17 EDT 2019


Lisa Roach <lisaroach14 at gmail.com> added the comment:

Lately I have been having my doubts around having MagicMocks also create AsyncMocks as children. 

Should a MagicMock really have a __aenter__ magic method? 
Is this too far from the original MagicMock if we change child mocks to default not to their parent type, but to their parent type *or* AsyncMock if asynchronous?

It makes the using the mocks easier, since you can just use MagicMock or AsyncMock for whatever you are doing and not think about when to use which. But it also might make the code more confusing, since it isn't as clear when to use one or the other.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38163>
_______________________________________


More information about the Python-bugs-list mailing list