Add new mock features from Python 3.8
5j9 opened this issue · comments
In Python 3.8 unittest.mock
has had some improvements. It would be nice to see them in this library. The two features that I am currently looking for are:
MagicMock
objects are now awaitable.call
objects are now named tuples. See the example in documentation:
>>> kall.kwargs is kall[1]
True
At the core dev sprints I was part of a discussion on this. The upstream now contains several bug fixes along with new features like AsyncMock
that makes it Python 3 only. There are syntax level changes like async def
that make maintaining this backport to be Python 2 compatible impossible.
At some point maybe as Python 2 reaches end of life after January 1, 2020 there will be a backport of the bug fixes to make a final release. Then there will be a new release with this repo synced with upstream thus essentially dropping Python 2 support and becoming Python 3.5/3.6+ only. Thus users from 3.6 can install this backport and can use features like AsyncMock
that are 3.8+ only.
See #476, we can track there.