-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question on upstream AsyncMock #130
Comments
Hi,
Enventually (for projects which only support 3.8+), I believe that AsyncMock should become the class to use.
def my_symbol():
print("I'm not patched")
@unittest.patch("module.my_symbol")
async def coroutine():
# will print "I'm not patched", because the patch is only effective during the construction of the coroutine instance, not when the generator runs
my_symbol() The PR has been merged to CPython one week before I started a new job in a new country, so I don't think I'll have much time to work on asynctest before a while :/ |
also note that pypi mock has now backported AsyncMock for older pythons |
perhaps a new release with: if sys.version_info >= (3, 8):
from unittest.mock import AsyncMock as CoroutineMock
else:
from mock import AsyncMock as CoroutineMock and then depend on: install_requires =
pkgutil_resolve_name; python_version < "3.9" |
Thanks to python/cpython#9296, Python3.8 now has
unittest.mock.AsyncMock
I wonder if this means that some
asynctest
use can be pivoted to upstreamAsyncMock
, in what cases, etc.Likewise, what features or use cases remain exclusive to
asynctest
?Advice is highly appreciated, and could possibly even make it to readme / rtd.
The text was updated successfully, but these errors were encountered: