Skip to content
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

Use stdlib AsyncMock when available #1297

Merged
merged 2 commits into from
Apr 11, 2024
Merged

Conversation

mgorny
Copy link
Contributor

@mgorny mgorny commented Apr 5, 2024

As indicated in the asyncmock project description:

Mock 4.0+ (included within Python 3.8+) now includes an awaitable mock
mock.AsyncMock. This is recommended for new projects.

Appropriately, update the test code to use unittest.mock.AsyncMock in Python 3.8+, and update the test requirements to pull in mock >= 4.0 (rather than the obsolete asyncmock package) for older Python versions.

As indicated in the `asyncmock` project description:

> Mock 4.0+ (included within Python 3.8+) now includes an awaitable mock
> `mock.AsyncMock`. This is recommended for new projects.

Appropriately, update the test code to use `unittest.mock.AsyncMock`
in Python 3.8+, and update the test requirements to pull in `mock >=
4.0` (rather than the obsolete `asyncmock` package) for older Python
versions.
@CLAassistant
Copy link

CLAassistant commented Apr 5, 2024

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@richardm-stripe
Copy link
Contributor

richardm-stripe commented Apr 5, 2024

Hello @mgorny. Thank you for the contribution.

I agree with this change. I think when the time comes and we've dropped support for python < 3.8 having the code like this will make it easier to make the appropriate update.

Can you sign the CLA in the github comment from @CLAassistant? (looks good)

@richardm-stripe richardm-stripe mentioned this pull request Apr 5, 2024
@ramya-stripe ramya-stripe merged commit 4346e49 into stripe:master Apr 11, 2024
15 checks passed
@mgorny mgorny deleted the asyncmock branch April 11, 2024 19:03
@mgorny
Copy link
Contributor Author

mgorny commented Apr 11, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants